You know that each position in a decimal number means a power of 10. Starting from the right, moving to the left, we have the number of ones, then the number of tens, then the number of hundreds, thousands, ten-thousands, and so on. So 4242 is 2 ones plus 4 tens plus 2 hundreds and 4 thousands. That is: 2 + 40 + 200 + 4000, resulting in, yes, 4242. 10 is the base of this decimal system
Hexadecimal has base 16, and octal has base 8.
In a hexadecimal number, going from right to left, you have the number of ones, the number of sixteens, the number of two-hundred-and-fifty-sixes, the number of four-thousand-and-ninety-sixes, and so on. So 0x65 means 5 ones plus 6 sixteens, that is, 5 plus, um..., 96. That makes 101 in decimal. So 0x65 (read it as 65 in hex) is 101 in decimal.
I leave the octal conversion as an exercise. Do not forget that an int literal begining with 0 is octal.
Any modern (high-)school maths book should have a few pages on this topic.
[ September 17, 2005: Message edited by: Barry Gaunt ]
six times sixteen is nintysix not eighty
[ September 17, 2005: Message edited by: Barry Gaunt ] [ September 17, 2005: Message edited by: Barry Gaunt ]