title: What is wrong with this for loop and what it prints?
body: <p>I have to write a program that compares the running time of two different lists, one being array based and one being a linked list. I have to run it twenty times at twenty different lengths, so I made a for loop to do this for me, it is supposed to run twenty times, but only printed out one thing, and then it made my computer very slow, and it said the process was still running on my IDE for a while. Heres the code, ask if you need more but this should be sufficient. I wanna know why the for loop only prints one thing and after that it says still running.</p>
  
  <pre><code>public class Foo4 {
     public static void main(String[] args) {
        int max = Integer.MAX_VALUE;
  
        int diff = max / 20;
        int holder = 1;
        long test1time;
        long test2time;
        StopWatch timer = new StopWatch();
        int t;
  
        for (t = 0; t &lt; 20; t++) {
           AList test1 = new AList();
           Slist test2 = new Slist();
  
           for (int j = 0; j &lt; holder; j++) {
              test1.addFirst("the");
              test2.addFirst("thee");
           }
  
           timer.reset();
           timer.start();
           test1.getLast();
           timer.stop();
           test1time = timer.getElapsedTime();
           timer.reset();
           timer.start();
           test2.getLast();
           timer.stop();
           test2time = timer.getElapsedTime();
           System.out.println(test1time + " : " + test2time);
           holder += diff;
        }
     }
  }
  </code></pre>