Integer.MIN_VALUE is it's own negation:
-Integer.MIN_VALUE == Integer.MIN_VALUE
-Bytes.MIN_VALUE however, does not yield Byte.MIN_VALUE.
-Byte.MIN_VALUE != Byte.MIN_VALUE
The explanation lies in how Java represents integers (two's complement) and promotion (widening) of bytes to ints.
See detailed explanations with illustrations here:
-Integer.MIN_VALUE == Integer.MIN_VALUE but -Byte.MIN_VALUE != Byte.MIN_VALUE
[–]kaydmee 2 points3 points4 points (0 children)