After this was answered I continued to work my way through the code. It work's perfect this way:
static String[][] bubbleSort(String customerdata[][], int sortafter, int asc)
{
String temp [];
boolean sort;
do{
sortiert = true;
for (int i = 0 ; i < customerdata.length - 1; i++){
if(customerdata[i][sortafter].compareTo(customerdata[i+1][sortafter]) < 0){
temp = customerdata[i];
customerdata[i] = customerdata[i+1];
customerdata[i+1] = temp;
sort = false;
}
}
}while(!sort);
return customerdata;
}
But as you can see, I'm missing int asc inside this function. What I want is to additionaly return a sorted descending or ascending array (depending wether asc == 1 (asc), or asc == 0 (desc)).
I'm at loss how to implement it inside this. I mean currently I can sort it ascending or descending, but once AFTER this method was called with some nasty long for() and if() loops.
I'd like to have it compactly inside and depending wether I give bubblesort(x,0,0) or (x,0,1) the list should be returned descending or ascending.