title: Why equal operator works for Integer value until 128 number?
body: <p>Why Integer <code>==</code> operator does not work for 128 and after Integer values? Can someone explain this situation?</p>
  <p>This is my Java environment:</p>
  <pre class="lang-none prettyprint-override"><code>java version &quot;1.6.0_37&quot;
  Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
  Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01, mixed mode)
  </code></pre>
  <p>Sample Code:</p>
  <pre class="lang-java prettyprint-override"><code>Integer a;
  Integer b;
  a = 129;
  b = 129;
  
  for (int i = 0; i &lt; 200; i++) {
      a = i;
      b = i;
  
      if (a != b) {
          System.out.println(&quot;Value:&quot; + i + &quot; - Different values&quot;);
      } else {
          System.out.println(&quot;Value:&quot; + i + &quot; - Same values&quot;);
      }
  }
  </code></pre>
  <p>Some part of console output:</p>
  <pre><code>Value:124 - Same values
  Value:125 - Same values
  Value:126 - Same values
  Value:127 - Same values
  Value:128 - Different values
  Value:129 - Different values
  Value:130 - Different values
  Value:131 - Different values
  Value:132 - Different values
  </code></pre>