Java multiplication of negative numbers

java, multiplication

Solution

Overflow.

Check out Integer.MAX_VALUE. An Integer in Java is a 32 bit 2s complement value. You can't exceed the MAX_VALUE.

Problem

In normal maths terms, -1756046391 * -1291488517 will equal 2267913749295792147. When i enter the exact same equation in java, i get the answer: -1756046391 * -1291488517 = 19. Can anyone shed any light on this?

Original source