Java tutorial
import java.util.Arrays; import java.util.Collections; import java.util.Comparator; public class Main { public static void main(String[] args) { // initializing unsorted short array Short[] sArr = new Short[] { 3, 13, 1, 9, 21 }; System.out.println(Arrays.toString(sArr)); // create a comparator Comparator<Short> comp = Collections.reverseOrder(); // sorting array with reverse order using comparator Arrays.sort(sArr, comp); System.out.println(Arrays.toString(sArr)); } }