Sorting 2D array in java

Newbie Member
20Mar2008,14:59   #1
shilpa dessai's Avatar
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
Go4Expert Founder
20Mar2008,15:38   #2
shabbir's Avatar
Moved to Java forum