sort 2d array in ascending order c++ and then returning it code example Example: sort 2d array Arrays.sort(myArr, (a, b) -> Double.compare(a[0], b[0]));