code: public StrBuilder setLength(final int length) {
          if (length < 0) {
              throw new StringIndexOutOfBoundsException(length);
          }
          if (length < size) {
              size = length;
          } else if (length > size) {
              ensureCapacity(length);
              final int oldEnd = size;
              final int newEnd = length;
              size = length;
              for (int i = oldEnd; i < newEnd; i++) {
                  buffer[i] = CharUtils.NUL;
              }
          }
          return this;
      }
docs: Updates the length of the builder by either dropping the last characters
  or adding filler of Unicode zero.
  
  @param length  the length to set to, must be zero or positive
  @return this, to enable chaining
  @throws IndexOutOfBoundsException if the length is negative