public void selection () { int i; int j; int minIndex; int temp; for (i = 0; i < (list.length-1); i++) { minIndex = i; for (j = (i+1); j < list.length; j++) { if (list[j] < list[minIndex]) minIndex = j; } if (minIndex != i) { temp = list[i]; list[i] = list[minIndex]; list[minIndex] = temp; } } }