public class SelectionSort {
static final int SIZE=10;
public static void SelectSort(int[] a)
{
int temp, index;
for (int i=0;i<a.length-1;i++)
{
index=i;
for(int j=i+1;j<a.length;j++)
{
if(a[j]>a[index])
{
index=j;
}
}
if(index!=i)
{
temp=a[i];
a[i]=a[index];
a[index]=temp;
}
/*for(int h=0; h<a.length;h++)
{
System.out.println(""+a[h]);
}*/
}
}
}
网友评论