In article <nHKwd.779$EL5.573@trndny09>, Jeff
() dropped a +5 bundle of words...
> I need a sorting method for a 2 dimensional object array. Does anyone know
> of a publicly available one?
You could make your own with nested for loops. (1 for the first
dimension, which is really an array, and 1 for the array being held in
the slot.
<sscce>
public class Test {
int [][] thing = { {1,2,3},
{4,5,6},
{7,8,9} };
public void findNumber() {
int number = 5;
for (int a = 0; a < 3; a++) {
for (int b = 0; b < 3; b++){
if (number == thing[a][b]) {
System.out.println("\n" + number);
} else {
System.out.print("\nCouldn't find it.");
} // end if/else
} //end inside for loop
} // end outside for loop
} // end findNumber
public static void main(String[] args) {
Test drive = new Test();
drive.findNumber();
}
}
</sscce>
--
Starshine Moonbeam
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM
|