posted 21 years ago
ab=0xFFFFFFFA
in hexadecimal A=10, B=11, C=12, D=13, E=14, F=15
in binary 10,11,12,13,14,15 are 1010, 1011, 1100, 1101, 1110, 1111 resp
so ab = 1111 1111 1111 1111 1111 1111 1111 1010
~ab = 0000 0000 0000 0000 0000 0000 0000 0101 + 1 = 110 = -6
Can anybody tell me how to convert these?
byte a = (byte)127;
byte b = (byte)128;
byte c = (byte)255;
byte d = (byte)256;
//......
System.out.print(a + " " + b + " " + c + " " + d);
Ans: a = 127, b = -128, c = -1, d = 0
Thanks.
[ November 19, 2003: Message edited by: dimple kaushik ]