hi.. i am trying to sort my 2D array such that only the 2nd column get sorted.. i tried to use Arrays.sort(arr[a]) but it seem to sort the whole array

example of what i want:
before sort
a[0][0]= 9 a[1][0] = 50
a[0][1]= 5 a[1][1] = 5
a[0][2]= 3 a[1][2] = 78
a[0][3]= 6 a[1][3] = 23
a[0][4]= 2 a[1][4] = 67

aft sort
a[0][0]= 2 a[1][0] = 5
a[0][1]= 3 a[1][1] = 23
a[0][2]= 5 a[1][2] = 50
a[0][3]= 6 a[1][3] = 67
a[0][4]= 9 a[1][4] = 78

the code i m using now
 for (int i=0;i<dist.length;i++)
        {
            Arrays.sort(dist[i]);
        }

output of current code:
before sort
a[0][0]= 9 a[1][0] = 50
a[0][1]= 5 a[1][1] = 5
a[0][2]= 3 a[1][2] = 78
a[0][3]= 6 a[1][3] = 23
a[0][4]= 2 a[1][4] = 67

aft sort
a[0][0]= 2 a[1][0] = 9
a[0][1]= 3 a[1][1] = 23
a[0][2]= 5 a[1][2] = 50
a[0][3]= 5 a[1][3] = 67
a[0][4]= 6 a[1][4] = 78