Если вам важен только порядок последнего столбца, просто проверьте последний столбец, а затем переместите всю строку соответственно:
void BubbleSort2D(double arr1[][]){
for(int m=0; m<10; m++) {
for(int i = 0; i < 9; i++)
{
if(arr1[i][5] < arr1[i+1][5])
{
for(int j = 0; j < 6; j++)
{
double temp = arr1[i][j];
arr1[i][j] = arr1[i+1][j];
arr1[i+1][j] = temp;
}
}
}
}
}
public static void main(String args[]) {
double[][] arr2D = { {6814.00, 85.00, 86.00, 92.00, 88.00, 87.75},
{7234.00, 76.00, 81.00, 84.00, 78.00, 79.75},
{6465.00 , 87.00, 54.00, 68.00, 72.00, 70.25},
{7899.00, 92.00, 90.00, 88.00, 86.00, 89.00},
{9901.00, 45.00, 78.00, 79.00, 80.00, 70.50},
{8234.00, 77.00, 87.00, 84.00, 98.00, 86.50},
{7934.00, 76.00, 91.00, 84.00, 65.00, 79.00},
{7284.00, 56.00, 81.00, 87.00, 98.00, 80.50},
{7654.00, 76.00, 87.00, 84.00, 88.00, 83.75},
{3534.00, 86.00, 81.00, 84.00, 73.00, 81.00} };
driver.BubbleSort2D(arr2D);
for(int m=0; m<9; m++) {
for(int i = 0; i < 6; i++)
{
System.out.print(arr2D[m][i] + " ");
}
System.out.println();
}
}
Выход:
7899,0 92,0 90,0 88,0 86,0 89,0
6814,0 85,0 86,0 92,0 88,0 87,75
8234,0 77,0 87,0 84,0 98,0 86,5
7654,0 76,0 87,0 84,0 88,0 83,75
3534,0 86,0 81,0 84,0 73,0 81,0
7284,0 56,0 81,0 87,0 98,0 80,5
7234,0 76,0 81,0 84,0 78,0 79,75
7934,0 76,0 91,0 84,0 65,0 79,0
9901,0 45,0 78,0 79,0 80,0 70,5