public class SelectSort {
public static void main(String args[]){
int arr[] = {3,12,-43,99,23,11};
printArr(arr);
sortSel(arr);
printArr(arr);
}
public static void sortSel(int arr[]){
for(int x = 0,len = arr.length;x < len - 1;x++){
for(int y = x + 1;y < arr.length;y++){
if(arr[x] > arr[y]){
int temp = arr[x];
arr[x] = arr[y];
arr[y] = temp;
}
}
}
}
public static void printArr(int arr[]){
System.out.print("[");
for(int i = 0,len = arr.length;i < len ;i++){
if(i != arr.length - 1)
System.out.print(arr[i] + " ,");
else
System.out.print(arr[i]);
}
System.out.print("]");
}
}