Kaustubh G Sharma wrote:ohk but 16 represent which char? and there's no addition sign between them... what is the logic behind it?

How does 23 (in decimal) = 23? Because it is (2 * 10) + 3.

The first digit is 2, which is in the 10s position. So to get the value of the first digit you do (2 * 10). The second digit is in the ones position, and has a value of 3. To get the total value of the number you sum the values of the digits, so 23 == (2 * 10) + 3.

Since you understand Hexadecimal you should be able to apply the same conversion to 0x7f.

Kaustubh G Sharma wrote:I am not able to understand conversion for 0x7f to 127. I do understand hexadecimal system.. but for this conversion I am confused please help

I fear that several people (including me) are having a problem understanding your problem. If you "do understand hexadecimal system", then surely you understand that '7f' can't be anything but 127 decimal?

Or is it the '0x' bit that is bothering you? That is simply a prefix that tells the Java compiler that the characters that follow are hexadecimal.

Winston

Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here

Kaustubh G Sharma wrote:I am not able to understand conversion for 0x7f to 127. I do understand hexadecimal system.. but for this conversion I am confused please help

I fear that several people (including me) are having a problem understanding your problem. If you "do understand hexadecimal system", then surely you understand that '7f' can't be anything but 127 decimal?

Or is it the '0x' bit that is bothering you? That is simply a prefix that tells the Java compiler that the characters that follow are hexadecimal.

Winston

Yes Winston I was confused because of this 0x thing.. Now my doubt is clear.. Thanks to all of you