class MySort implements Comparator { public int compare(Integer x, Integer y) {  return y.compareTo(x); } }
And the code fragment: Integer[] primes = {2, 7, 5, 3}; MySort ms = new MySort(); Arrays.sort(primes, ms); for (Integer p2 : primes) {  System.out.print(p2 + " "); }