title: output Map.Entry<Sentence, Integer> in descending order with java
body: <p>Obviously this is a very naive attempt, but I'm quite inexperienced at programming. What I'd like to do is print these values in descending order, i.e. the biggest would print first and then smallest print last, how can I achieve this?</p>
  
  <pre><code>for (Map.Entry&lt;Sentence, Integer&gt; entry : ontology.ruleCount.entrySet()) 
      {
          if(entry.getValue() &gt;= 10)
          System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 9)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 8)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 7)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 6)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 5)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 4)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 3)
              System.out.println(entry.getKey()+" : "+entry.getValue());
  
          if(entry.getValue() &gt;= 2)
              System.out.println(entry.getKey()+" : "+entry.getValue());
      } 
  </code></pre>