–1 vote
1.4k views
in Programming by Expert (3.8k points)
Here in the code ,I want column 1 in  ascending order, but not working . If you know how to use Bubble sort on 2D Array So please help me!
 
This is my code: 
 
String[][] 2dArray = new String[counter][2];
2dArray [counter][column1] = String.valueOf(counter);
2dArray [counter][column2] = "something something something";
for(int i = 0; i < 2dArray.length-1; i++){
     for(int j = i + 1; j > 0; j--){
       if(2dArray[i][j] < 2dArray[i-1][j]){ 
           int[][] temp = 2dArray[i-1][j];
           2dArray[i-1][j] = 2dArray[i][j];
           2dArray[i][j] = temp;                  
       }
     }
}

 

Your answer

Thanks for contributing your answer!
Please be sure to answer the question. Provide details with examples and share your research!
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated