If an integer multiplication overflows, then the result is the low-order bits of the mathematical product as represented in some sufficiently large two's-complement format. As a result, if overflow occurs, then the sign of the result may not be the same as the sign of the mathematical product of the two operand values.
1000000*1000000 results in an overflow. The lower-order 32 bits (int is 32 bits) are 0xd4a51000 which is -727,379,968. [This message has been edited by Nain Hwu (edited October 09, 2001).]
Joined: Aug 13, 2001
Hi Nain: When i fed the Hex # you said is the low-order 32 bits in NT calc. I am getting 3567587328 and not the number you said/I asked. Also, can you explain/write down how you got 0xD4A51000. Thanks
Joined: Sep 16, 2001
Madan, I used the toHexString() method in class Integer. Here is what I did: