package Utils.Sort;
/**
*@author Linyco
*利用选择排序法对数组排序,数组中元素必须实现了Comparable接口。
*/
public class ChooseSort implements SortStrategy
{ /**
*对数组obj中的元素以选择排序算法进行排序
*/
public void sort(Comparable[] obj)
{ if (obj == null)
{ throw new NullPointerException("The argument can not be null!");
}
Comparable tmp = null;
int index = 0;
for (int i = 0 ;i < obj.length - 1 ;i++ )
{ index = i;
tmp = obj[i];
for (int j = i + 1 ;j < obj.length ;j++ )