title: Multiplication of two ints overflowing to result in a negative number
body: <p>Consider this snippet from the Java language specification.</p>
  
  <pre><code>class Test {
      public static void main(String[] args) {
          int i = 1000000;
          System.out.println(i * i);
          long l = i;
          System.out.println(l * l);
      }
  }
  </code></pre>
  
  <p>The output is </p>
  
  <pre><code>-727379968
  1000000000000
  </code></pre>
  
  <p>Why is the result <code>-727379968</code> for <code>(i*i)</code>? Ideally it should be 1000000000000.</p>
  
  <p>I know the range of Integer is from –2147483648 to 2147483647. so obviously 1000000000000
  is not in the given range. </p>
  
  <p>Why does the result become <code>-727379968</code>?</p>