Java Term of the Week: Hexadecimal
The past two terms we've looked at were about the denary and octal numbering systems. Now it's the turn of hexadecimal. It differs from the previous two systems by using a combination of digits and letters to represent numbers, and by having a base of 16.The digits and letters used are 0,1,2,3,4,5,6,7,8,9 and A,B,C,D,E,F.
It follows the same rules as the other two except that once you get to 9 it starts to use letters (i.e., A=10, B=11, C=12, D=13, E=14, F=15). To make it easier to understand think back to denary, the number 30 is the same as saying 3 x tens + 0 x ones. In hexadecimal, because it has a base 16, it's 1 x sixteens + 14 x ones, which is 1E. The trick is to remember that 14 in hexadecimal is represented by "E".
Hexadecimal surpassed octal numbers as a compact way to represent binary numbers. The reason being that four bits can go from 0000 (i.e., zero) to 1111 (i.e., 15) which matches one hexadecimal digit perfectly, 0 (i.e., zero) to F (i.e., 15). Therefore to represent a byte (8 bits) all that's needed is two hexadecimal digits.


No comments yet. Leave a Comment