class="java" name="code"> List<Integer> test = new ArrayList<Integer>(); test.add(5); test.add(1); test.add(3); System.out.println(test); Collections.sort(test, new Comparator<Integer>(){ @Override public int compare(Integer o1, Integer o2) { return o1-o2; } }); System.out.println(test);