I'm struggling a bit with binary in Java and Python to translate a program
In python when I execute the following commands, I've got
>>> print ord(pack('>H', 32809)[0])
128
>>> print ord(pack('>H', 32809)[1])
41
In Java, I expect to have the same result when I execute the following command, but it's not there:
bsh % print ((byte)((32809 & 0xFF00) >> 8));
-128
bsh % print ((byte)(32809 & 0x00FF));
41
Can somebody explain me why 128 is negative in Java? Many thanks.