Code:
/*
*Diese Methode bekommt ein 2d StringArray, welches zeilenweise
*nach doubleWerten sortiert wird
*Ich freue mich immer über Hinweise, die zur Verbesserung meines
*rekursiven Verständnisses führen...
*/
public String[][] sortByDouble(String[][] toSort,int i){
String val1="",val2="";
if(i-1>=0 && toSort.length>1){
val1 = toSort[i][0];
val2 = toSort[i-1][0];
}
if(!(val1!=null
&& val2.equals(""))){
if(Double.parseDouble(val1)
>=Double.parseDouble(val2))return sortByDouble(toSort,i-1);
else {
String[][] tmpSort = toSort;
for(int c=0;c<5;c++){
String t2 = toSort[i-1][c];
String t1 = toSort[i][c];
tmpSort[i][c] = t2;
tmpSort[i-1][c]= t1;
}
return sortByDouble(tmpSort,toSort.length-1);
}
}
else return toSort;
}