title: java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
body: <p>I am having an issue with arrays. The full stack trace is: </p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
      at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.7.0_79]
      at java.util.ArrayList.get(Unknown Source) ~[?:1.7.0_79]
      at xyz.lexium.brocubes.drops.DropDB.getRandomDrop(DropDB.java:17) ~[DropDB.class:?]
      at xyz.lexium.brocubes.blocks.BroBlock.onBlockDestroyedByPlayer(BroBlock.java:33) ~[BroBlock.class:?]
      at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:187) ~[PlayerControllerMP.class:?]
      at net.minecraft.client.multiplayer.PlayerControllerMP.func_178891_a(PlayerControllerMP.java:68) ~[PlayerControllerMP.class:?]
      at net.minecraft.client.multiplayer.PlayerControllerMP.func_180511_b(PlayerControllerMP.java:232) ~[PlayerControllerMP.class:?]
      at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1519) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2126) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
      at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
      at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
      at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
      at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
      at GradleStart.main(Unknown Source) [start/:?]
  </code></pre>
  
  <p>The code I use for this is:</p>
  
  <pre><code>DropBase drop = DropDB.getRandomDrop();
  for (int i = 1; i &lt; drop.getDrops().size() -1; i++) {
      EntityItem item = new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(), drop.getDrops().get(i));
      System.out.println(i);
      worldIn.spawnEntityInWorld(item);
  </code></pre>
  
  <p>This code calls DropDB and selects a random drop from a registered list. The list is perfectly fine. Here is the code for getDrop is:</p>
  
  <pre><code> public static DropBase getRandomDrop() {
       Random rand = new Random();
          int n = rand.nextInt(drops.size()) + 1;
          System.out.println(n);
          System.out.println(drops.size());
          return drops.get(n);
      }
  </code></pre>
  
  <p>This code causes this error. I have tired to look at the other questions around here. They <em>have not</em> worked. </p>