Arrays.sort(intervals, new Comparator<int[]>(){ public int compare(int[] o1, int[] o2) { return o1[0] - o2[0]; } });