Hexadecimal to Decimal Conversion
A hexadecimal number can be converted to decimal by following the method:
0xhnhn-1...h1h0 where hi is any of 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F ,
can be converted to the decimal number:
hn×16n + hn-1×16n-1 + ... + h1×16 + h0.
For example the decimal representation of 0x2A9 is 2×162 + 10×161 + 9 = 681.