code: public void setSize(int newSize) {
  	if (newSize<0) throw new IndexOutOfBoundsException("newSize:"+newSize);
  
  	int currentSize = size();
  	if (newSize!=currentSize) {
  		if (newSize>currentSize) beforeInsertDummies(currentSize,newSize-currentSize);
  		else if (newSize<currentSize) removeFromTo(newSize, currentSize-1);
  	}
  }
docs: Sets the size of the receiver.
  If the new size is greater than the current size, new null or zero items are added to the end of the receiver.
  If the new size is less than the current size, all components at index newSize and greater are discarded.
  This method does not release any superfluos internal memory. Use method <tt>trimToSize</tt> to release superfluos internal memory.
  @param newSize the new size of the receiver.
  @throws IndexOutOfBoundsException if <tt>newSize &lt; 0</tt>.