fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5.  
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. ArrayList<Integer> lista = new ArrayList<>();
  11. lista.add(432);
  12. lista.add(23);
  13. lista.add(18);
  14. lista.add(2);
  15. lista.add(100);
  16.  
  17. System.out.println("Antes: " + lista);
  18. Collections.sort(lista, Collections.reverseOrder());
  19. System.out.println("Depois: " + lista);
  20. }
  21. }
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
Antes: [432, 23, 18, 2, 100]
Depois: [432, 100, 23, 18, 2]