The range that ints can have in Java is -2147483648 to 2147483647. Notice the final digit there.

So, -(-2147483648) is +2147483648, but that's too big to store in an int variable. So you get an overflow, and the value wraps round to the bottom of the range again.

For integer values, negation is the same as subtraction from zero. The Java programming language uses two's-complement representation for integers, and the range of two's-complement values is not symmetric, so negation of the maximum negative int or long results in that same maximum negative number. Overflow occurs in this case, but no exception is thrown.

luck, db
There are no new questions, but there may be new answers.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com