Sorting 2D array in java

shilpa dessai's Avatar
Newbie Member
Hi, I've got a 2D array which I would like to sort into descending order according to the first column but keep the information in the 2nd column in the same row as the information in the first column no matter where the sort moves it to in the array. To explain more clearly:
Supposing I had this 2D array:

|5 1|
|6 2|
|3 3|
|8 4|
|2 5|

I want my bubble sort to be able to sort it into:

|8 4|
|6 2|
|5 1|
|3 3|
|2 5|

All the info I've found on bubble sorts has only been about 1D arrays. Any help or a nudge in the right direction would be really appreciated!
Regards
shilpa
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Moved to Java forum
0