Hexadecimal notation is a common way of viewing raw data on a computer. Understanding hexadecimal notation is an important skill for any serious computer programmer.
HOW HEXADECIMAL WORKS
The word "hexadecimal" means a number system with 16 digits. Because humans have ten fingers upon which to count, we learned to think in "decimal" notation which uses 10 numerals - 0 through 9. Thinking about how decimal notation works will make it much easier to understand hexadecimal.
In decimal notation, you write a number as powers of ten, with the higher powers to the left. The number one hundred and twenty three is written as 123. In this number, the leftmost digit is called the hundreds digit because it indicates the number of hundreds in the number. Next is the tens digit, followed by the ones digit. A hundred is 10 to the power of 2, ten is 10 to the power of 1, and one is 10 to the power of zero. Therefore, each digit in 123 has the following meaning:
1 = one hundred, or 1 times 100, or 1 times 10 to the power of 2
2 = twenty, or 2 times 10, or 2 times 10 to the power of 1
3 = three, or 3 times 1, or 3 times 10 to the power of 0
One hundred plus twenty plus three equals one hundred and twenty three.
Hexadecimal notation works the same way, but it uses 16 numerals instead of only ten. The numbers 0 through 9 are represented by the numerals 0 through 9, while the numbers 10 through 15 are represented by A through F respectively. Here are the numbers 0 through 15 in decimal form followed by their hexadecimal equivalents:
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
Because there are 16 numerals, numbers are written as powers of 16 rather than powers of 10. The number one hundred and twenty three written in hexadecimal notation would be 7B. It breaks down in the following way:
7 = one hundred and twelve, or 7 times 16, or 7 times 16 to the power of 1
B = eleven, or 11 times 1, or 11 times 16 to the power of 0
One hundred and twelve plus eleven equals one hundred and twenty three.
Hexadecimal notation is simply another way of writing the value of a number. While it may seem daunting at first, you will find that after some practice hexadecimal notation will begin to feel almost as natural as the decimal system you have used since kindergarten.
By : Mike Wever.
No comments:
Post a Comment