Can anyone please explan why I am getting this output. I thouht Byte.MIN_VALUE should be - 2 to the power of 7 and hence its binary representation would be
2(power) 7 is represented as 10000000
complement 01111111
-2(power) 7 is 10000000
But this is not the represention in the output in line 3, and line 4 for hex
C:\>
java test Byte.MAX_VALUE in Binary:1111111
Byte.MAX_VALUE in Hex:7f
Byte.MIN_VALUE in Binary:11111111111111111111111110000000 //o/p line 3
Byte.MIN_VALUE in Hex:ffffff80 // o/p line 4
I have used Integer.toHexString function passing Byte.MAX_VALUE and Byte.MIN_VALUE, also used Integer.toBinaryString.