docs: public Buffer capacity(int capacity) {
      if (capacity > maxCapacity) {
        throw new IllegalArgumentException("capacity cannot be greater than maximum capacity");
      } else if (capacity < this.capacity) {
        throw new IllegalArgumentException("capacity cannot be decreased");
      } else if (capacity != this.capacity) {
        // It's possible that the bytes could already meet the requirements of the capacity.
        if (offset(capacity) > bytes.size()) {
          bytes.resize((int) Math.min(Memory.Util.toPow2(offset(capacity)), Integer.MAX_VALUE));
        }
        this.capacity = capacity;
      }
      return this;
    }