I am trying to convert an int to byte.
int i = 128; byte b = (byte) i;
I know the range of byte if -128 to 127 and the rule of storing an i
Bytes are treated as signed values in Java; like you pointed out, the range of a byte is [-128,127]. Adding 1 to 127 flips the sign bit, which means that 127 + 1 = -128.