public void beforeInsert(int index,Object element){
  if (index > size || index < 0)   throw new IndexOutOfBoundsException("Index: " + index + ", Size: "+ size);
  ensureCapacity(size + 1);
  System.arraycopy(elements,index,elements,index + 1,size - index);
  elements[index]=element;
  size++;
}

public void beforeInsert ( int index , Object element ) { if ( index > size || index < 0 ) throw new IndexOutOfBoundsException ( "Index: " + index + ", Size: " + size ) ; ensureCapacity ( size + 1 ) ; System . arraycopy ( elements , index , elements , index + 1 , size - index ) ; elements [ index ] = element ; size ++ ; }
inserts the specified element before the specified position into the receiver . shifts the element currently at that position ( if any ) and any subsequent elements to the right .
