// Sort an array which has elements that are array of size 2// Sort from the highest first element of sub-array, if same then sort from the lowest second element of sub-arrayArrays.sort(people, (a,b) -> { if (a[0] == b[0]) return a[1] - b[1]; return b[0]-a[0];});// Sort array of elements that are long typeArrays.sort(longArray, (a, b) -> { if (a[0] == b[0]) return Long.compare(a[1], b[1]); return Long.compare(a[0], b[0]);});// Use the built-in comparator will not lead to overflow issueArrays.sort(points, (a, b) -> Integer.compare(a[0], b[0]));