title: Storing time intervals in a java array
body: <p>This is a homework assignment I am working on. Before I ask, I am not looking for a piece of code. I would just like some assistance figuring out where I may have gone wrong.</p>
  
  <p>The objective of the assignment is to run an applet that loops 100,000 times. There are 25 intervals and the time at each interval needs to be stored in an array. So far I am able to get the applet to run and print correctly, but the array is only storing the first value. I'm thinking that there is a formatting issue or something small keeping me from figuring out this problem, but I've searched for a while now and I can't seem to figure this out.</p>
  
  <p>The code I have is as follows:</p>
  
  <pre><code>    public class Line1TimedTest extends JApplet 
      {
          long start, elapsed, arrayValue;
          int x1=50, y1=50, x2=500, y2=500, limit=100000, value;
          DecimalFormat fmt;
  
  
          public void init() 
          {
      start = System.nanoTime();
      fmt = new DecimalFormat("###,###,###,###,###");
      }
  
  
  
      public void paint (Graphics g) 
      {
          int x, y, temp;
          float m, b;
              long [] arrayTimes = new long [25];
  
          for (int i = 1; i &lt;=limit; i++) 
          {   
              m = (float)(y2-y1)/(x2-x1);
              b = y1 - m * x1;
              int value = 0;
  
              for (x = x1; x &lt;= x2; x++)
              {
                  y = (int)(m * x + b + 0.5);
                  g.drawRect(x,y,0,0);
  
              }
              if (i%4000==0)
              {
                  elapsed = System.nanoTime() - start;
                  arrayValue = elapsed;
                  arrayTimes[value] = arrayValue;
                  System.out.println(fmt.format(i) + " lines drawn");
                  value++;
              }
  
  
          }
  
  
      //insert print statement
  
  
       } 
  
  }
  </code></pre>
  
  <p>The program compiles and runs with no errors, but the array is only being populated with a value at index 0. All other values are 0. If anyone could take a look and see what I might be missing I'd really appreciate it.</p>
  
  <p>Thanks</p>