I initialized a byte as follows:
byte b = (byte) 0b11110000000;
You should be getting
When you explicitly cast an
byte, the lowest 8 bits are taken, and the rest are discarded.
In your example the lowest 8 bits are
10000000, and the decimal value of that number is
Without the explicit cast, the code won't pass compilation, since your assignment causes a loss of information.