<import java.util.Scanner; public class RockefellerA7 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please Enter Number of Rows: "); int row = input.nextInt(); System.out.println("Please Enter Number of Columns: "); int column = input.nextInt(); int [][] arr = new int[row][column]; System.out.println("Enter Values: "); for(int i = 0; i < arr.length; i++){ for(int j = 0; j < arr[i].length; j++){ arr[i][j] = input.nextInt(); } } boolean swapped = false; do { swapped = false; for(int i = 0; i < arr.length-1; i++){ for(int j = 0; j< arr[i].length-1; j++){ if (i== arr.length - 1 && j== arr.length-1){ } else if (j == arr[i].length-1){ if (arr[i][j]> arr[i][0]){ int temp = arr[i][0]; arr[i][0] = arr[i+1][0]; arr[i+1][0] = temp; swapped = true; } } else { if(arr[i][j] < arr[i+1][j+1]){ int temp = arr[i][j]; arr[i][j] = arr[i+1][j+1]; arr[i+1][j+1] = temp; swapped = true; } } } } } while (swapped); for (int i = 0; i < arr.length; i++){ for (int j = 0; j < arr[i].length; j++){ System.out.printf("%4d", arr[i][j]); } System.out.println(); } } } >

I am entering {25,8,12,13,5,3,88,0,2,1,92,4}

and my output is:

92 88 12 13

5 22 8 0

2 1 3 4

Here is my program. I have to sort my array so it will go smallest to largest but it isnt working HELP

three conditions it has to fill:

1. if Iis the row size -1 and j is the column -1 do nothing

2. else if j is the column size -1 check the values and swap

3. other wise just check the values and swap