code: public static char[] ensureCapacity(
        char[] array, int minLength, int padding) {
      checkArgument(minLength >= 0, "Invalid minLength: %s", minLength);
      checkArgument(padding >= 0, "Invalid padding: %s", padding);
      return (array.length < minLength)
          ? copyOf(array, minLength + padding)
          : array;
    }
docs: Returns an array containing the same values as {@code array}, but
  guaranteed to be of a specified minimum length. If {@code array} already
  has a length of at least {@code minLength}, it is returned directly.
  Otherwise, a new array of size {@code minLength + padding} is returned,
  containing the values of {@code array}, and zeroes in the remaining places.
  
  @param array the source array
  @param minLength the minimum length the returned array must guarantee
  @param padding an extra amount to "grow" the array by if growth is
  necessary
  @throws IllegalArgumentException if {@code minLength} or {@code padding} is
  negative
  @return an array containing the values of {@code array}, with guaranteed
  minimum length {@code minLength}