code: public void growTo(int size, boolean pad) {
      if (this.size >= size)
        return;
      this.ensure(size);
      for (int i = this.size; i < size; i++)
        this.elements[i] = pad;
      this.size = size;
    }
docs: Grows the vector to a new size and initializes the new elements with a given value.
  @param size the new size
  @param pad  the value for new elements