void resize(int nsize){
  Object narray=allocateArray(nsize);
  System.arraycopy(array,0,narray,0,Math.min(nsize,getArrayLength()));
  array=narray;
}

void resize ( int nsize ) { Object narray = allocateArray ( nsize ) ; System . arraycopy ( array , 0 , narray , 0 , Math . min ( nsize , getArrayLength ( ) ) ) ; array = narray ; }
resize the underlying storage array to the given new size
