/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package selectionsort;
/**
*
* @author Angga
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int[] array={-5,-8,-11,0,34,1,1,6,9,22,15};
int idxMin;
int tmp;
for(int j=0;j<array.length-1;j++){
idxMin=j;
for(int i=j+1;i<array.length;i++){
if(array[i]<array[idxMin])
idxMin=i;
}
if(idxMin!=j){
tmp=array[idxMin];
array[idxMin]=array[j];
array[j]=tmp;
}
}
for(int i=0;i<array.length;i++){
System.out.print(array[i]+” “);
}
}
}