private static int[] trimArray(int[] array,int size){
  if (size < 0) {
    throw new IllegalArgumentException();
  }
  if (size == 0) {
    return NO_ERRORS;
  }
  int[] a=new int[size];
  System.arraycopy(array,0,a,0,size);
  return a;
}

private static int [ ] trimArray ( int [ ] array , int size ) { if ( size < 0 ) { throw new IllegalArgumentException ( ) ; } if ( size == 0 ) { return NO_ERRORS ; } int [ ] a = new int [ size ] ; System . arraycopy ( array , 0 , a , 0 , size ) ; return a ; }
trim the array to the required size .
