title: data.put() throws IndexOutOfBoundsException
body: <p>So i have this code to input an order and a price for a specified number of items
  public class SetMenu0 {</p>
  
  <pre><code>private double price;
  private int size;
  private String output;
  private String priceOutput;
  
  ArrayList orderList = new ArrayList&lt;String&gt;();
  ArrayList priceList = new ArrayList&lt;Double&gt;();
  
  public SetMenu0()
  {
      Scanner input = new Scanner(System.in);
      System.out.print("Enter New Order?(Y)(N): ");
      String init = input.nextLine();
  
      if(init.equalsIgnoreCase("y"))
      {
          System.out.print("Enter Number of Orders: ");
          size = input.nextInt();
  
          for(int i = 0; i&lt;=size; i++)
          {
              i++;
              System.out.print("Enter Order: ");
              orderList.add(input.next());
              System.out.print("Enter Price: ");
              priceList.add(input.nextDouble());
          }
      }
  }
  
  public ArrayList getOrd()
  {
      return orderList;
  }
  
  public ArrayList getPri()
  {
      return priceList;
  }
  
  public int getSize()
  {
      return size;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Now when i use it with the TreeMap i get an indexOutOfBoundsException here
      public static void main(String[] args)
      {
          //blank workbook
          XSSFWorkbook workbook = new XSSFWorkbook();</p>
  
  <pre><code>    //create blank sheet
      XSSFSheet sheet = workbook.createSheet("Food");
  
      SetMenu0 set = new SetMenu0();
  
      ArrayList orderList = set.getOrd();
      ArrayList priceList = set.getPri();
  
      int size = orderList.size();
      Map&lt;String, Object[]&gt; data = new TreeMap&lt;String, Object[]&gt;();
      data.put("1", new Object[]{"Order", "Price"});
      try{
      for(int i=0; i&lt;size; i++)
      {
          int in = i+2;
          String lineNum = ""+in;
          data.put(lineNum, new Object[]{orderList.get(i), priceList.get(i)});
      }
      }
      catch(IndexOutOfBoundsException e)
      {
          System.out.print("problem");
      }
  </code></pre>
  
  <p>The exception happens when set the size to 3 upwards.</p>