code: public void setLength(final int len) {
          if (len < 0 || len > this.array.length) {
              throw new IndexOutOfBoundsException("len: "+len+" < 0 or > buffer len: "+this.array.length);
          }
          this.len = len;
      }
docs: Sets the length of the buffer. The new length value is expected to be
  less than the current capacity and greater than or equal to
  {@code 0}.
  
  @param      len   the new length
  @throws     IndexOutOfBoundsException  if the
  {@code len} argument is greater than the current
  capacity of the buffer or less than {@code 0}.