I am having some confusion about how to convert hexadecimal numbers to decimal. Could someone please go through a simple explanation for me? My main confusion is what do the letters mean? (like 0xffa) (I do not mean toHexString() either. I mean using a brain and pencil) Thanks!!!
Viji Bharat
Ranch Hand
Joined: Sep 18, 2000
Posts: 101
posted
0
Remember this table for Hex Decimal equivalent 0..9 0..9 A 10 B 11 C 12 D 13 E 14 F 15 To convert a hex to decimal, do this Start from the right most hex value going towards left. Multiply the rightmost hex value by 16 to the power of 0. Multiply second right hex value by 16 to the power of 1. etc. Now, add all these values to get the decimal equivalent. Lets take an Eg. Lets convert Hexadecimal AF to its decimal equivalent A F | |_ X 16 <sup>0</sup> (16 power 0) | |_ X 16 <sup>1</sup> (16 power 1) From the table above F -> 15, A -> 10 So, the decimal equivalent is 15 X 16 <sup>0</sup> + 10 X 16 <sup>1</sup> = 15 + 160 = 175 HTH [This message has been edited by Viji Bharat (edited October 19, 2000).]
Rob Levo
Ranch Hand
Joined: Oct 01, 2000
Posts: 167
posted
0
Hex A = 10 Decimal Hex B = 11 Decimal Hex C = 12 Decimal Hex D = 13 Decimal Hex E = 14 Decimal Hex F = 15 Decimal To convert hex(base 16) to decimal(base 10) right most digit(or letter) = digit * 16^0 (1) next digit = digit * 16^1 next digit = digit * 16^2 etc Hope that was clear.
Originally posted by Barry Andrews: I am having some confusion about how to convert hexadecimal numbers to decimal. Could someone please go through a simple explanation for me? My main confusion is what do the letters mean? (like 0xffa) (I do not mean toHexString() either. I mean using a brain and pencil) Thanks!!!