title: How to sort a list of BigDecimal objects
body: <p>Given the following input:</p>
  
  <pre><code>-100
  50
  0
  56.6
  90
  </code></pre>
  
  <p>I have added each value as a <code>BigDecimal</code> to a list.</p>
  
  <p>I want to be able to sort the list from highest to lowest value.</p>
  
  <p>I have attempted to do this in the following way:</p>
  
  <pre><code>public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
  
          List&lt;BigDecimal&gt; list = new ArrayList&lt;BigDecimal&gt;();
  
          while(sc.hasNext()){
              list.add(new BigDecimal(sc.next()));
          }
  
          Collections.reverse(list);
  
          for(BigDecimal d : list){
  
              System.out.println(d);
          }
      }
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>90
  56.6
  0
  50
  -100
  </code></pre>
  
  <p>In this instance 50 should be a higher value than 0.</p>
  
  <p>How can I correctly sort a BigDecimal list from highest to lowest taking into account decimal and non decimal values?</p>