Arrays.sort(contests, (a, b) -> Integer.compare(b[0],a[0])); //decreasing order Arrays.sort(contests, (a, b) -> Integer.compare(a[0],b[0]); //increasing order