title: Java 1.6 java.lang.IndexOutOfBoundsException Question
body: <p>I seem to be getting an array out of bounds exception but the problem is the error message and  my System.out and eclipse's debug tools tell me conflicting information.</p>
  
  <p>This is my exception:</p>
  
  <blockquote>
    <p>Exception in thread "main"
    java.lang.IndexOutOfBoundsException:
    Index: 9, Size: 9<br>
            at java.util.ArrayList.RangeCheck(ArrayList.java:547)<br>
            at java.util.ArrayList.get(ArrayList.java:322)<br>
            at InduceC45.C45(InduceC45.java:61)<br>
            at InduceC45.main(InduceC45.java:15)<br></p>
  </blockquote>
  
  <p>Line 61 in InduceC45 is:</p>
  
  <pre><code>for(int attLoop = 1; attLoop &lt;= attributes.get(splitAtt); attLoop++){
  </code></pre>
  
  <p>It's saying that splitAtt is out of bounds for ArrayList attributes, simple enough.</p>
  
  <p>So I tried using the debugger and I also tried putting some System.out's to try to figure out what was going on, they basically gave me the same info, so here is the System.out's</p>
  
  <pre><code>System.out.println("splitAtt="+splitAtt);
  System.out.println("attributes="+attributes);
  System.out.println("attributes="+attributes.get(splitAtt));
  </code></pre>
  
  <p>This the print outs resulted in this:<br></p>
  
  <blockquote>
    <p>splitAtt=9<br> attributes=[3, 3, 3, 2,
    3, 6, 3, 4, 4, 2]<br> attributes=2</p>
  </blockquote>
  
  <p>I really don't understand why I can reference it and not get an error if it's not in the loop. I don't think I'm doing anything tricky, let me know if anyone can think of a possible cause.</p>
  
  <p>In case anyone wants the full source...
  <a href="http://github.com/Ryuho/CSC466/blob/master/lab3/src/InduceC45.java" rel="nofollow">http://github.com/Ryuho/CSC466/blob/master/lab3/src/InduceC45.java</a> Line 61</p>