| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 
 | public class Test {
 public static void main(String[] args) {
 
 
 Integer[] a = { 9, 8, 7, 2, 3, 4, 1, 0, 6, 5 };
 
 Comparator cmp = new MyComparator();
 
 Arrays.sort(a, cmp);
 
 Arrays.sort(a, Collections.reverseOrder());
 for (int x : a) {
 System.out.print(xw + " ");
 }
 }
 }
 
 
 
 
 
 class MyComparator implements Comparator<Integer> {
 public int compare(Integer o1, Integer o2) {
 
 if (o1 < o2) {
 return 1;
 } else if (o1 > o2) {
 return -1;
 } else {
 return 0;
 }
 }
 }
 
 
 |