The explicit cast from long to int is different from the explicit cast from a double to int.
For double to int, it actually has to convert the bits. Examine the value as a double and then convert it to the nearest int value.
For long to int, it just assumes that you know what you are doing and truncates the 4 high bytes. And believe it or not, if you take only the 4 low bytes of a Long.MAX_VALUE, you get the bit
pattern for -1.
Henry