title: IndexOutOfBoundsException in search for
body: <p>i have a problem that return me the follow error</p>
  
  <pre><code>Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 1
  at java.util.ArrayList.RangeCheck(ArrayList.java:547)
  at java.util.ArrayList.get(ArrayList.java:322)
  at graphsshahar.TestDijkstra.main(TestDijkstra.java:38)
  </code></pre>
  
  <p>my program get a list of objects and i need to find in the list the equal to one 
  and then print it , here is the code</p>
  
  <pre><code>    public static void main (String [] args){
      System.out.println("begin");
  
      int one = 2;
      int two = 10;
      List&lt;Conniction&gt; tempDeal = ConnictionDAO.getInstance().findPath(one, two);
  
      List&lt;String&gt; oneid = new ArrayList&lt;String&gt;();
      List&lt;String&gt; twoid = new ArrayList&lt;String&gt;();
  
      for (int j = 1; j &lt;= tempDeal.size(); j++) {
       System.out.println("get");
          if( Integer.parseInt(tempDeal.get(j).getOneid()) == one ) 
          {
              oneid.add(tempDeal.get(j).getOneid());
              System.out.println(oneid.get(j));
  
          }
  
      }
      System.out.println("end");
  </code></pre>
  
  <p>what should i fix ?
  i dont know what is wrong with the if statement </p>