title: Integer == int allowed in java
body: <p>I was wondering if java automatically turns a Integer into an int when comparing to an int? Or will the == try and compare references on primitives?</p>
  
  <p>Is this always true or do I need to do <code>i.intValue()==2</code>?</p>
  
  <pre><code>Integer i = Integer.valueOf(2);
  if (i==2){
  //always?
  }
  </code></pre>