How to sort an two d array?------------
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), arr[][] = new int[n][2];
for(int i =0;i<arr.length;i++){
for(int j =0;j<arr[i].length;i++){
arr[i][j] = cin.nextInt();
}
}
int j =0;
for(int i = 0;i<arr.length;i++){
for(int k = 0;k<arr.length-j;k++){
if(arr[k][j]>arr[i][j]){
int temp = arr[i][k];
arr[k][i] = arr[k+1][i];
arr[k+1][i] = temp;
}
}
}
}
}