Java byte is a signed 8-bit numeric type with a range of -128 to 127 ( JLS 4.2.1 ), 233 is out 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)
However, if you insist on storing the first 8 bits of int in a byte, then byteVariable = (byte) intVariable does this. If you need to return this value to int , you must mask any possible sign extension (i.e. intVariable = byteVariable & 0xFF; ).
polygenelubricants
source share