Go Back   Computer Forums > General Computing > Networking | DNS
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 02-28-2013, 08:43 PM   #1
Beta Member
Join Date: Feb 2013
Location: Australia
Posts: 2
Default Hexadecimal Binary

I am trying to find an easier way of understanding hexadecimal binary. Can anyone help or send a useful link for this?


ptrath12 is offline   Reply With Quote
Old 03-01-2013, 08:23 AM   #2
Site Team
root's Avatar
Join Date: Mar 2004
Posts: 7,872
Default Re: Hexadecimal Binary

you want an easier way,

what do you currently not understand about it?

I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 03-01-2013, 09:12 AM   #3
Site Team
berry120's Avatar
Join Date: Jul 2009
Location: England, UK
Posts: 3,422
Default Re: Hexadecimal Binary

hexadecimal binary
What the heck is that?!
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 03-01-2013, 10:29 AM   #4
Site Team
jmacavali's Avatar
Join Date: Jun 2009
Posts: 4,868
Default Re: Hexadecimal Binary

Originally Posted by root View Post
you want an easier way,

what do you currently not understand about it?
For starters, perhaps the fact that hexadecimal and binary are two different things...
Don't take life too seriously -- no one gets out alive. Plus, who wants to arrive to the hereafter in pristine condition wearing a suit and tie?
I want to slide in sideways, worn out, used up, hair a mess, clothes tattered, & screaming, "Whooo! What a ride!"
jmacavali is offline   Reply With Quote
Old 03-01-2013, 12:48 PM   #5
In Runtime
Join Date: Feb 2013
Location: UK
Posts: 156
Default Re: Hexadecimal Binary

To understand numeric bases (which is what you are asking - in this case base 16 and base 2) you need to go back to first principles with decimal. The following example should start you off with an idea, but is by no means comprehensive. I'm sure there are plenty of good websites out there (like this: HowStuffWorks "Understanding Binary and Hexadecimal Number Systems")

First you need to divide you number into columns, where each column (starting from the right) is an order of magnitude larger than the previous:

123 -> 3*1's + 2*10's + 1*100's

For the sake of being pedantic, the above should be written more precisely as:

123 -> 3*(10^0) + 2*(10^1) + 1*(10^2)

Here you can clearly see we're talking about a decimal (base-10) number.

123 in binary is computed exactly the same (just lots more steps as each step accounts for fewer possible values, 2 states per column rather than 10):
*Note: remember that you can only have 1* or 0* in front of each block because binary only has 2 states

123 -> 1*(2^0) + 1*(2^1) + 0*(2^2) + 1*(2^3) + 1*(2^4) + 1*(2^5) + 1*(2^6)

which is more clearly verified by (remember that n^0 is always 1 for any value of n):

123 -> 1*(1) + 1*(2) + 0*(4) + 1*(8) + 1*(16) + 1*(32) + 1*(64)

123 -> 1 + 2 + 0 + 8 + 16 + 32 + 64

reading the numbers outside the brackets from right to left gives:

123 -> 1 1 1 1 0 1 1 (which calculator should verify is 123 in binary)


Now for hexadecimal:

There are now 16 states for each column, 0-9 and A-F, therefore the number will most likely be fewer columns as each column can represent 6 more states

123 -> B*(16^0) + 7*(16^1)

Remeber that B is equivalent to 11 in decimal:

123 -> 11*(1) + 7*(16)

123 -> 11 + 112

Taking the values outside the brackets (from right to left) gives 7B as the hexadecimal value for 123.


Obviously the above examples simply show why the result is the way it is, they don't let you work it out from a decimal starting point. For this you can think in blocks:


123 < 160

160 would be 16*10 and therefore be A0 in hexadecimal (because A is 10 and it's in the second column from the right - the 16^1 column)

You now know the answer is less than A0

7*16 is 112, (which is 70 in hex) so you know the answer is larger than that, but we're close now - the core idea is find the multiple of your base (16) which is less than you desired number (123), but such that an increase of 1 would go beyond it (8*16 = 128, 128 > 123)

Having got to 112 with 0x70 (0x is the prefix for hex numbers), you know you need to add 11, the value for 11 in hex is B so the result becomes 0x7B.

I hope that helps explain these concepts a little, I think everyone has issues with this initially - once you've done any network programming you learn to read hex like it was english!
_michaelm is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 02:37 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0