public class SelectSort {
public static void main(String [] args){
int [] a = {1,52,3,21,541,122,321};
for(int i = 0; i < a.length; i++){
int idx = i;
for(int j = i+1; j < a.length ; j++){
if ( a[idx] > a[j]){
idx = j;
}
}
if(idx > i){
a[i] = a[i] + a[idx];
a[idx] = a[i] - a[idx];
a[i] = a[i] - a[idx];
}
}
for(int c: a){
System.out.println(c);
}
}
}