public class SortTest
{ public static void main(String[] args)
{
StopWatch clock=new StopWatch();
int increment, steps, sort;
sort=Integer.parseInt(args[0]);
increment=Integer.parseInt(args[1]);
steps=Integer.parseInt(args[2]);
for (int len=increment; len <= steps*increment; len+=increment){
int[] a = ArrayUtil.randomIntArray(len, 1000000);
switch(sort){
case 0:
clock.start();
IntSelectionSort.sort(a);
clock.stop();
break;
case 1:
clock.start();
MyMergeSort.sort(a);
clock.stop();
break;
case 2:
clock.start();
MergeSort.sort(a);
clock.stop();
break;
case 3:
clock.start();
MyMergeSort2.sort(a);
clock.stop();
break;
case 4:
clock.start();
MyMergeSort2.sort(a);
clock.stop();
break;
case 5:
clock.start();
QuickSort.sort(a);
clock.stop();
break;
}
System.out.println(len +"\t"+clock.getElapsedTime());
clock.reset();
}
}
}