April 18, 2014 Leave a comment
Humans normally represent numeric values using the decimal (base 10) numeral system. We can also represent numbers as hexadecimal, or base 16.
The hexadecimal numeral system uses 16 different digits (numeric symbols), rather than 10. You represent a numerical value using a string of these hexadecimal (or hex) digits. The 16 digits used are the digits 0-9 and the letters A-F. (E.g. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F). Comparing to the decimal system, A then represents 10, B represents 11, up to F, which represents 15. Hexadecimal constants are often written as “0x”, followed by the digits.
Moving from right to left, the digits in a base 16 system represent powers of 16 (1, 16, 256, 4096, etc. or 16^0, 16^1, 16^2, 16^3, etc). The value of a number represented as hexadecimal is the sum of the value of each digit multiplied by the appropriate power of 16. For example:
As an example, the hexadecimal number 0x3A8E is equivalent to the decimal number 14,990.