package labone.insertionsort;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

import static labone.insertionsort.InsertionSort.*;

public class Driver {

    public static void main(String[] args) throws FileNotFoundException {

        int key;
        int n;
        for (int power = 4; power <= 25; power++){
            n = (int) Math.pow(2, power);
            int[] array = new int[n];
            for (int i = 0; i < array.length; i++) {
                array[i] = (int) (Math.random() * n + 1);
            }
            key = (int) (Math.random() * (Math.pow(2, power) + 1));
            System.out.println("The key on iteration " + power + " is "
                    + key + ".");

            startTimer();
            System.out.println("timeInitial: " + timeInitial);
            linearSearch(array, key);

            startTimer();
            System.out.println("timeInitial: " + timeInitial);
            insertionSort(array);
            binarySearch(array, key, 0, (n - 1));
            System.out.println();
        }

        Scanner scan = new Scanner(new File("keys.csv"));
        scan.useDelimiter(",");
        n = 1000;
        key = (int) (Math.random() * n + 1);
        int[] csvArray = new int[n];
        for (int i = 0; scan.hasNext(); i++) {
            csvArray[i] = Integer.parseInt(scan.next());
        }
        scan.close();

        startTimer();
        System.out.println("timeInitial: " + timeInitial);
        linearSearch(csvArray, key);

        startTimer();
        System.out.println("timeInitial: " + timeInitial);
        insertionSort(csvArray);
        binarySearch(csvArray, key, 0, (n - 1));
        System.out.println();
    }

    private static void startTimer() {
        timeInitial = System.nanoTime();
    }

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

@@ -163,16 +163,17 @@
 ort.*;%0A%0A
+%0A
 public c
@@ -843,32 +843,57 @@
 rch(array, key);
+%0A            stopTimer();
 %0A%0A            st
@@ -1043,32 +1043,57 @@
 y, 0, (n - 1));%0A
+            stopTimer();%0A
             Syst
@@ -1565,16 +1565,37 @@
 y, key);
+%0A        stopTimer();
 %0A%0A      
@@ -1743,32 +1743,53 @@
 y, 0, (n - 1));%0A
+        stopTimer();%0A
         System.o
@@ -1895,21 +1895,223 @@
 ;%0A    %7D%0A
+    
 %0A    
+private static void stopTimer() %7B%0A        timeFinal = System.nanoTime();%0A        System.out.println(%22timeFinal: %22 + timeFinal);%0A        timeElapsed = (timeFinal - timeInitial);%0A    %7D%0A%0A    protected 
 static l
@@ -2123,32 +2123,42 @@
 imeInitial;%0A    
+protected 
 static long time
@@ -2168,16 +2168,26 @@
 al;%0A    
+protected 
 static l

Update Driver.java