package labtwo.mergesort;

import java.util.Arrays;
import labone.insertionsort.*;

public class Driver {

	public static void main(String[] args) {
		
		int n;
		for (int power = 4; power <= 25; power++){
			n = (int) Math.pow(2, power);
			int[] iArray = new int[n];
			int[] mArray = new int[n];
			int[] temp   = new int[n];
			for (int i = 0; i < n; i++) {
				iArray[i] = (int) (Math.random() * (n + 1));
				mArray[i] = iArray[i];
			}
			
			System.out.println("Merge sort iteration " + power + " ");
			startTimer();
			MergeSort.mergeSort(iArray, temp, 0, n - 1);
			stopTimer();
			
			System.out.println
			("Insertion sort iteration " + power + " ");
			startTimer();
			InsertionSort.insertionSort(mArray);
			stopTimer();
		}
	}
	
    private static void startTimer() {
        timeInitial = System.nanoTime();
    }
    
    private static void stopTimer() {
        timeFinal = System.nanoTime();
        System.out.println("timeInital: " + timeFinal);
        System.out.println("timeFinal: " + timeFinal);
        timeElapsed = (timeFinal - timeInitial);
        System.out.println("timeElapsed: " + timeElapsed + "\n");
    }

    protected static long timeInitial;
    protected static long timeFinal;
    protected static long timeElapsed;
}

@@ -494,32 +494,172 @@
 + power + %22 %22);%0A
+%09%09%09/*%0A%09%09%09 * Print statement is commented out. java.util.Arrays has been imported.%0A%09%09%09 * System.out.println(Arrays.toString(iArray));%0A%09%09%09 */%0A
 %09%09%09startTimer();
@@ -730,151 +730,567 @@
 %0A%09%09%09
+/*
 %0A%09%09%09
-System.out.println%0A%09%09%09(%22Insertion sort iteration %22 + power + %22 %22);%0A%09%09%09startTimer();%0A%09%09%09InsertionSort.insertionSort(mArray);%0A%09%09%09stopTimer();
+ * Print statement is commented out. java.util.Arrays has been imported.%0A%09%09%09 * System.out.println(Arrays.toString(iArray));%0A%09%09%09 */%0A%09%09%09%0A%09%09%09System.out.println(%22Insertion sort iteration %22 + power + %22 %22);%0A%09%09%09/*%0A%09%09%09 * Print statement is commented out. java.util.Arrays has been imported.%0A%09%09%09 * System.out.println(Arrays.toString(mArray));%0A%09%09%09 */%0A%09%09%09startTimer();%0A%09%09%09InsertionSort.insertionSort(mArray);%0A%09%09%09stopTimer();%0A%09%09%09/*%0A%09%09%09 * Print statement is commented out. java.util.Arrays has been imported.%0A%09%09%09 * System.out.println(Arrays.toString(mArray));%0A%09%09%09 */
 %0A%09%09%7D

Update Driver.java