public class TimeExperiment {

    public static void main(String[] args) throws InterruptedException {
        
        for (int n = 1; n < 13; n++) {
            Stopwatch stopwatch = new Stopwatch();
            for (int i=0; i < n; i++)
                for (int j=i; j < i*i; j++)
                    if (j%i == 0) {
                       for (int k=0; k < j; k++)
                           Thread.sleep(1);  // <-- primitive operation of interest
                                             //     in the notes, this was "count++;"
                                             //     we changed it here to "Thread.sleep(1);"
                                             //     which pauses the execution of the program
                                             //     for one millisecond.  This let's us see
                                             //     more clearly the effect of n on how many
                                             //     this one line of code gets executed as
                                             //     the time it now takes is much longer
                                             //     than the other incrementing and assignments
                                             //     going on in the rest of the code
                    }
            System.out.println(stopwatch.elapsedTime());
        }
    }
    
    // Try graphing the n values versus the corresponding printed elapsed times.
    // Then produce a log-log plot of the same.  
    // What happens to the slope of the log-log plot as n increases ..does it approach 4?
}

