public void ensureCapacity(int minCapacity){
  int oldCapacity=capacity;
  if (minCapacity > oldCapacity) {
    int newCapacity=(oldCapacity * 3) / 2 + 1;
    if (newCapacity < minCapacity)     newCapacity=minCapacity;
    BitVector vector=toBitVector();
    vector.setSize(newCapacity * bitsPerElement);
    this.bits=vector.elements();
    this.capacity=newCapacity;
  }
}

public void ensureCapacity ( int minCapacity ) { int oldCapacity = capacity ; if ( minCapacity > oldCapacity ) { int newCapacity = ( oldCapacity * 3 ) / 2 + 1 ; if ( newCapacity < minCapacity ) newCapacity = minCapacity ; BitVector vector = toBitVector ( ) ; vector . setSize ( newCapacity * bitsPerElement ) ; this . bits = vector . elements ( ) ; this . capacity = newCapacity ; } }
ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory . if necessary , allocates new internal memory and increases the capacity of the receiver .
