The number types in Java are signed, meaning they can be negative or positive. The leftmost bit (the most significant bit) is used to represent the sign, where a 1
means negative and 0
means positive.
Byte
Max 01111111 = +127
Min 10000000 = -128
11111111 = -1
Short
Max 0111111111111111 = +32767
Min 1000000000000000 = -32768
0000000011111111 = +255
Binary negative numbers are represented in 2's complement form.