public static void main(String[] args) { int N = 10000000; int K = 1; Integer[] newArray = new Integer[N]; StopWatch sw = new StopWatch(); while (K <= N) { newArray = createArray(N, K); Sorting obj = new Sorting(newArray); newArray = (Integer[]) obj.selectionsort(); System.out.println("The time needed for K=" + K + " is " + sw.elapsedTime()); K = K * 2; System.out.println( "The number of comparisons is " + obj.compareCount() + "; " + "The number of exchanges is " + obj.exchangeCount() + "; " + "The number of copies is " + obj.copyCount() + "; "); } }