title: How to sort an ArrayList by an int in decreasing order?
body: <p>I have the following code that sorts my Player class by how good they are rated. There is an <code>ArrayList</code> of <code>Player</code>s in my <code>Game</code> class that I am trying to sort by how high they are rated. Right now, it sorts in opposite order (example after code).  </p>
  
  <pre><code>// Player class
  @Override
  public int compareTo(Player o) {
      return(this.getHowGood() &gt; o.getHowGood() ? -1 :
          (this.getHowGood() == o.getHowGood() ? 0 : 1));
  }
  </code></pre>
  
  <p>Game class</p>
  
  <pre><code>PlayerSorter playerSorter = new PlayerSorter(allCompetitors);
  ArrayList&lt;Player&gt; sortedPlayer = playerSorter.getSortedPlayerByHowGood();
  System.out.println("-----Sorted JobCandidate by age: Ascending-----");
  for(Player player : sortedPlayer) {
      System.out.println(player.getHowGood() + "");
  }
  </code></pre>
  
  <p>PlayerSorter class:</p>
  
  <pre><code>import java.util.ArrayList; 
  import java.util.Collections;   
  
  public class PlayerSorter {
  
      ArrayList&lt;Player&gt; players = new ArrayList&lt;&gt;();
  
      public PlayerSorter(ArrayList&lt;Player&gt; player) {
          this.players = player;
      }
  
      public ArrayList&lt;Player&gt; getSortedPlayerByHowGood() {         
          Collections.sort(players);
          return players;
      }
  }
  </code></pre>
  
  <p>What I get in the console (what is on my JFrame):</p>
  
  <pre><code>-----Sorted Player by rating: Ascending /*descending is what I'm looking for here*/-----
  8
  14
  22
  33
  36
  42
  44
  51
  52
  54
  58
  60
  60
  62
  65
  73
  75
  84
  93
  99
  </code></pre>
  
  <p>As I showed above, the numbers are ascending in how good, and I'm trying to make the opposite of that, but can't figure it out. I tried changing the numbers in the <code>Player</code> class to their opposite (negative), and that didn't work. I tried reversing the order of the <code>ArrayList</code> with <code>Collections.reverse()</code> and that didn't work.</p>