title: Java exception when checking if Integer value is null
body: <p>The following snippet of code causes my program the throw a null pointer exception and I'm struggling to determine why:</p>
  
  <pre><code>private void ...(){
      HierarchyForm hForm = (HierarchyForm)
      Integer id = hForm.getId();
      if (id != null &amp;&amp; id.intValue() &gt; 0){ &lt;-- exception thrown here
          ...
      }
      .
      .
      .
  }
  </code></pre>
  
  <p>When it crashes, the value of "id" is null. I know it's probably something simple but I can't understand why.</p>
  
  <p>edit:  here is a short program showing it failing. seems to be issue with .intValue comparison <a href="http://ideone.com/e.js/H0Mjaf" rel="nofollow">http://ideone.com/e.js/H0Mjaf</a></p>
  
  <p>edit: i'm building for java 1.6.0_45</p>