fork(5) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. List<Integer> nums = new ArrayList<Integer>();
  9. for (Integer i : new Integer[] {5,3,4,8,9,1}) {
  10. nums.add(i);
  11. }
  12. Collections.sort(nums, new Comparator<Integer>() {
  13. public int compare(Integer o1, Integer o2) {
  14. return o1 < o2 ? 1 : (o1 == o2 ? 0 : -1);
  15. }
  16. });
  17. for (Integer i : nums) {
  18. System.out.println(i);
  19. }
  20. }
  21. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
9
8
5
4
3
1