title: Long cannot be dereferenced
body: <p>I did almost everything to solve the annoying issue with "Long cannot be dereferenced", but anything worked out. Thus, can anyone please, help me? The problem is when I check if program timed out in <code>if(System.currentTimeMillis().longValue()==finish)</code>, the comparison is not working.</p>
  
  <pre><code>public void play() 
      {            
          long begin = System.currentTimeMillis();
          long finish = begin + 10*1000; 
  
          while (found&lt;3 &amp;&amp; System.currentTimeMillis() &lt; finish) {
              Command command = parser.getCommand();
              processCommand(command);
          }
          if(System.currentTimeMillis().longValue()==finish){
              if(found==1){System.out.println("Time is out. You found "+found+" item.");}
              else if(found&gt;1 &amp;&amp; found&lt;3){System.out.println("Time is out. You found "+found+" items.");}}
          else{
              if(found==1){System.out.println("Thank you for playing. You found "+found+" item.");}
              else if(found&gt;1 &amp;&amp; found&lt;3){System.out.println("Thank you for playing. You found "+found+" items.");}
              else{System.out.println("Thank you for playing.  Good bye.");}
          }
      }
  </code></pre>