posted 24 years ago
Hi,
I'm getting the same result. check the Integer Leteral range.
Integer.MIN_VALUE = -2147483648
Integer.MAX_VALUE = 2147483647
1. (Math.abs(Integer.MIN_VALUE)) // prints -2147483648
2. (Math.abs(-2147483648)) // prints -2147483648
3. (Math.abs(-2147483647)) // prints 2147483647
line 1 and 2 's output as per abs function,it should be positive
2147483648 , but the value it is out of range.
Decimal Int literals must be in the range -2147483648
to 2147483647.
Best Regards
Arvind