title: Why does incrementing a Java int eventually result in a negative number?
body: <p>I was trying to check different inputs and creating infinite loops in java and I found that once the <code>int</code> is getting incremented over the maximum limit it turns in to negative <code>-2147482958</code>. I am just increasing the int in infinite loop...</p>
  <h3>Code:</h3>
  <pre><code>public static void infiniteLoop(){
          for(int i=0;i&gt;-1;i++){
              i = i + 1000;
              System.out.println(i);
          }
      }
  </code></pre>
  <p>The last to value gets printed out is,</p>
  <pre><code>2147483337
  -2147482958
  </code></pre>
  <p>Now, Why does it goes to negative?</p>