//选择排序
public class SelectSortTest {
public static void main(String[] args) {
int arr[]={3,44,38,5,47,15,36,26,27,2,46,4,19,50,48};
// selectSort(arr);
selectSort1(arr);
for (int i : arr) {
System.out.print(i+" ");
}
}
private static void selectSort1(int[] arr) { for (int i=0;i<arr.length;i++){ int min=arr[i]; for(int j=i+1;j< arr.length;j++){ if(min>arr[j]){ int temp=min; min=arr[j]; arr[j]=temp; } } arr[i]=min; } }