title: Very simple for loop error Java
body: <p>I have no idea why this isn't working.</p>
  
  <pre><code>public static int getMaxPosition(ArrayList&lt;Integer&gt;list)
  {
      int max=list.get(0);
      int maxPos=0;
      int curr;
      int c;
      for (c=0; c&lt;list.size(); c++);
      {
          curr=list.get(c);
          if (curr&gt;max);
          {
              maxPos=curr;
              max=curr;
          }
      }
  
      return maxPos;
  }
  </code></pre>
  
  <p>This block of code gives a runtime error (IndexOutOfBoundsException) at the line <code>curr=list.get(c);</code>, and I can't find any good reason for it.</p>