What is wrong with this code I'm getting wrong output. I don't know what's wrong, I hope you could help me:
public class Main{
public static void main(String[] args){
int[] data={11,22,33,55,22,88,99,77};
SortingAlgo algo=new SortingAlgo();
data=algo.selectionSort(data);
System.out.println("numbers are"+ data);
}
}
Other class
public class SortingAlgo{
public int[] selectionSort(int[] data){
int lenD = data.length;
int j = 0;
int tmp = 0;
for(int i=0;i<lenD;i++){
j = i;
for(int k = i;k<lenD;k++){
if(data[j]>data[k]){
j = k;
}
}
tmp = data[i];
data[i] = data[j];
data[j] = tmp;
}
return data;
}
}
This is my out put:
numbers are[I@2e4b1dd8
Object#toString().