Index Out Of Bounds Exception
<p>I am working on a minecraft mod. The id system for EntityC4 is not working. The code is</p>

<pre><code>public static List C4 = new ArrayList();  

public static EntityC4 getitemfromnumber(int num)
{
    EntityC4 entity = (EntityC4)C4.get(num);

    return entity;
}
public static void createdetonater(EntityC4 c4, int num)
{
    C4.add(num, c4);


}
public static int getnum(){
     int num = 0;
      for(boolean a = true; a != false;){
          EntityC4 c = (EntityC4)C4.get(num);
          System.out.print("current num : " + num);

            if(c != null)
            {
                a = false;
            }else{
                System.out.print("entity " + num + " is null" );
         num++;
            }
      }
      return num;
   }
</code></pre>

<p>And when I use getnum() an error shows up that says</p>

<pre><code>java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
</code></pre>

<p>EDIT:Ty and the loop was supposed the first non-existent space in the list.</p>
