title: Java HashMap Get Highest 3 Values and their Key
body: <p>I am making a program that keeps a list of users and <code>Integer</code> values in a <code>HashMap</code>.  I need to loop through the <code>HashMap</code>, and get the three highest values.  I also need to get corresponding key of those three values. </p>
  
  <blockquote>
    <p>For example - HashMap with values:</p>
    
    <p>User1: 13</p>
    
    <p>User2: 325</p>
    
    <p>User3: 1</p>
    
    <p>User4: 456</p>
    
    <p>User5: 666</p>
  </blockquote>
  
  <p><strong>Would give me:</strong></p>
  
  <blockquote>
    <p>User5</p>
    
    <p>User4</p>
    
    <p>User2</p>
    
    <p>(In that order)</p>
  </blockquote>