public int[] toArray(){
  int[] result=new int[size];
  System.arraycopy(array,0,result,0,size);
  return result;
}

public int [ ] toArray ( ) { int [ ] result = new int [ size ] ; System . arraycopy ( array , 0 , result , 0 , size ) ; return result ; }
returns an array containing all of the elements in this list in the correct order .
