Multiple choice technology security

int i=987987987;
int j= i*10;  

what is the value of j (size of integer is 4 bytes)?

  1. 1289945278

  2. garbage. Integer j cannot hold such large values

  3. 9879879870

  4. Program is aborted.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, integer multiplication overflows silently according to 32-bit two's complement representation. The math is 987987987 * 10 = 9879879870, which in binary is 0x24CF1D0FE. Truncated to 32 bits, this is 0x4CF1D0FE, which is 1289945278 in decimal.