public synchronized Object remove(int index){
  Object[] elements=getArray();
  int len=elements.length;
  Object oldValue=elements[index];
  int numMoved=len - index - 1;
  if (numMoved == 0)   setArray(copyOf(elements,len - 1));
 else {
    Object[] newElements=new Object[len - 1];
    System.arraycopy(elements,0,newElements,0,index);
    System.arraycopy(elements,index + 1,newElements,index,numMoved);
    setArray(newElements);
  }
  return oldValue;
}

public synchronized Object remove ( int index ) { Object [ ] elements = getArray ( ) ; int len = elements . length ; Object oldValue = elements [ index ] ; int numMoved = len - index - 1 ; if ( numMoved == 0 ) setArray ( copyOf ( elements , len - 1 ) ) ; else { Object [ ] newElements = new Object [ len - 1 ] ; System . arraycopy ( elements , 0 , newElements , 0 , index ) ; System . arraycopy ( elements , index + 1 , newElements , index , numMoved ) ; setArray ( newElements ) ; } return oldValue ; }
removes the element at the specified position in this list . shifts any subsequent elements to the left ( subtracts one from their indices ) . returns the element that was removed from the list .
