code: public void add(int index, float e) {
      if (index < 0 || index > size) {
        throw new IndexOutOfBoundsException();
      }
      ensureCapacity(size + 1);
      if (index < size) {
        for (int i = size; i > index; i--) {
          elements[i] = elements[i - 1];
        }
      }
      elements[index] = e;
      size++;
    }
docs: Inserts a value into the array at the specified index.
  
  @param index
  The index at which to insert the new value.
  @param e
  The new value to insert.
  @throws IndexOutOfBoundsException
  if <code>index &lt; 0 || index &gt; size()</code>.