Java’s byte (-128 to 127)

Java’s byte is a signed 8-bit numeric type whose range is -128 to 127 (JLS 4.2.1). 233 is outside of this range; the same bit pattern represents -23 instead.

11101001 = 1 + 8 + 32 + 64 + 128 = 233 (int)
           1 + 8 + 32 + 64 - 128 = -23 (byte)

A byte plus a byte is an int in Java.

 

byte a = 1;
byte b = 2; 
byte c = a + b; // compile error (byte + byte = int)
byte c = (byte)(a + b); // corrected