sorting a 2d array code example Example: java sort 2d array Arrays.sort(myArr, (a, b) -> a[0] - b[0]);