bitwise-ANDing with 0xff is important?
Doesn't bitwise-ANDing with 0xff essentially mean getting the same value
back, for that matter, in this code?
byte[] packet = reader.readPacket();
short sh;
sh = packet[1];
enter code here`sh &= 0xFF;
System.out.print(sh+" ");
Weirdly, I get a -1 if that ANDing is not included but a 255 when included
Could someone explain the reason?
As I see it 0xff is just 1111 1111. Isn't it?
No comments:
Post a Comment