public static int[] sortArr(int[] a){
int temp;
for(int i = 0; i < a.length; i++){
temp = a[i];
a[i] = a[findMin(a, i)];
a[findMin(a, i)] = temp;
}
return a;
}
public static int findMin(int[] a, int start){
int min = a[start];
int minIndex= start;
for(int i = start; i < a.length; i++){
if(a[i] < min){
min = a[i];
minIndex = i;
}
}
return minIndex;
}
the sortArr method just returns the array that it is given, and I can't see why. I've worked it out on paper and it should be working. Can anybody see the problem?
findMin(),minorminIndex?