Ok Here's one thing that really irks me about Java, It's treatment of literals. Granted it's all Objects and Collections of Objects really but why can't you do this: byte b = 0xff & 0xff; // loss of precision?? @#$56@#$%#$^345
you can do this: byte b = 0x0f & 0x0f //? 15 - 0000 1111 -
According to comp-sci 101 class the first statement should not result in loss of precision because a byte is a byte and 0xff is 1111 1111 which is, you guessed it, a byte.
bit-and it with another set of 1111 1111 should result in 1111 1111 which doesn't looks like precision loss of anything.
You can answer, "twos complement", but two's complement is for representing negative and positive INTEGERS. It is implied when using hex that these are going to represent the INTEGERS in two's compliment so saying it's a loss of precision is false because you aren't actually loosing anything. Just a bad compiler, really.
You're assumption is wrong that use of two's complement is implied when using hex (unless you can provide documentation that implies otherwise).
Java bytes have an integer range of -127 to +128, therefore 0xff is outside the permitted range, hence the loss of precision. The compiler is working correctly.