code: public static short[] trimToCapacity(short[] array, int maxCapacity) {
  	if (array.length > maxCapacity) {
  	    short oldArray[] = array;
  	    array = new short[maxCapacity];
  	    System.arraycopy(oldArray, 0, array, 0, maxCapacity);
  	}
  	return array;
  }
docs: Ensures that the specified array cannot hold more than <tt>maxCapacity</tt> elements.
  An application can use this operation to minimize array storage.
  <p>
  Returns the identical array if <tt>array.length &lt;= maxCapacity</tt>.
  Otherwise, returns a new array with a length of <tt>maxCapacity</tt>
  containing the first <tt>maxCapacity</tt> elements of <tt>array</tt>.
  
  @param   maxCapacity   the desired maximum capacity.