Array is split into a sorted and unsorted part, values from the unsorted part are picked and placed into the correct position in the sorted part.
public static void selectionSort(int[]arr) {
int temp, currMin = arr[0], sorts = 1;
for(int i = 0; i<arr.length-1; i++) {
for(int j = i+1; j < arr.length; j++) {
//finds smallest element in array
if(arr[j]<currMin) {
currMin = arr[j];
}
}
temp = arr[currMin];
arr[currMin] = arr[i];
arr[i] = temp;
}
}