I have one question about the short data type in Java. I know that the range for short is between -32768 to 32767.
short
So, if I tried to add two short value
0111 0101 0011 0000 + 0111 0101 0011 0000 ______________________ 1110 1010 0110 0000
Java's short is encoded in two's complement. In two's complement the Most Significant Bit is considered as the sign bit, 0 is positive and 1 and negative.
0
1
1110 1010 0110 0000 = -5536 in two's complement