Java Reference
In-Depth Information
Hexadecimal
Decimal
Binary
0
0
0000
1
1
0001
2
2
0010
...
...
...
9
9
1001
A
10
1010
B
11
1011
C
12
1100
D
13
1101
E
14
1110
F
15
1111
Since a hexadecimal digit corresponds exactly to 4 binary bits, we can represent the binary number
above as a hexadecimal number just by taking successive groups of four binary digits starting from the
right, and writing the equivalent base 16 digit for each group. The binary number:
1111 0101 1011 1001 1110 0001
will therefore come out as:
F5B9E1
We have six hexadecimal digits corresponding to the six groups of four binary digits. Just to show it all
works out with no cheating, we can convert this number directly from hexadecimal to decimal, by again
using the analogy with the meaning of a decimal number, as follows:
F5B9E1 is:
15 x 16 x 16 x 16 x 16 x 16 + 5 x 16 x 16 x 16 x 16 + 11 x 16 x 16 x 16 + 9 x 16 x 16 + 14 x16 + 1
This in turn turns out to be:
15,728,640 + 327,680+ 45,056 + 2304 + 224 + 1
which fortunately totals to the same number we got when we converted the equivalent binary number to
a decimal value.
Search WWH ::




Custom Search