text: public synchronized void add(int index, E e) {Object[] newElements = new Object[elements.length + 1];System.arraycopy(elements, 0, newElements, 0, index);newElements[index] = e;System.arraycopy(elements, index, newElements, index + 1, elements.length - index);elements = newElements;}