while I was innocently performing some binary operations on bytes in Java, I encountered the following:
Apparently, byte & byte = int in Java. Same fate for chars.
Longs and booleans, on the other hand, don't suffer from this.
I expected to be able to keep working with bytes without casting.
It seems hackish to have to cast. Is there no more elegant approach?
Why don't I get a byte or char back? Does this have something to do with 32 bit registers and machine code?