Jump to content

hex to binary conversion understanding


hisoka

Recommended Posts

a hex digit is represented by four bits . This hex number 235 has 3 digits . When converted to binary , it gives 1000110101 which are 10 bits

if a hex digit is represented by four bits so why I do not  get 12 bits as a result ?

 

Link to comment
Share on other sites

Leading zeros do not change the value of the number.  If you have 789 things, is 0000000000789 a different number?  No, it's not, the zeros do not change the number.  The hex value would be 0010 0011 0101, those are the three bytes, but if you put those together then you don't need the leading zeros.

Also, this only matters if you are treating this as an actual number.  Maybe those 2 leading zeros are part of the binary data, which means you would not remove them.  If you're going to convert it to a number though, then you don't need leading zeros.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...