| 6.2 | Hexadecimal Numbers | ||
| 6.2.5 | Methods for working with hexadecimal and binary numbers |
|
Converting binary to hexadecimal and
hexadecimal to binary is an easy conversion. The reason is that
base16(hexadecimal) is a power of base 2(binary). Every four binary
digits (bits) are equal to one hexadecimal digit. The conversion looks
like this:
So if we have a binary number that looks
like 01011011, we break it into two groups of four bits. These look like
this: 0101 and 1011. When you convert these two groups to hex, they look
like 5 and B. So converting 01011011 to hex is 5B. To convert hex to
binary do the opposite. Convert hex AC to binary. First convert hex A
which is 1010 binary and then convert hex C which is 1100 binary. So the
conversion is hex AC is 10101100 binary.
As stated before hex works in exactly the opposite way. For every one hex digit, you convert it to four binary digits (bits). For example:
That is the conversion for binary to hexadecimal and from hexadecimal to binary.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||