seems to be a better question.The following code snippet will print 'true'.Code: Select all
float f = Integer.MIN_VALUE; int i = (int) f; System.out.println( i == Integer.MIN_VALUE);
The fact of the matter is that Integer.MIN_VALUE = (-1) * 2 ^ 31.
So it can be converted to binary, normalized and loss-free represented in IEEE-754 binary32 format as 11001111000000000000000000000000
The problem of Integer.MAX_VALUE is that it requires not obvious loosly convertion and normalization to (1)*2^31 = (Integer.MAX_VALUE + 1) and vice versa.
Is the original question(with Integer.MAX_VALUE) really captured from exam and focused on the details of loosly conversion?
(f.e. the trick won't come out with Integer.MAX_VALUE / 2)