code: public char[] toCharArray(final int startIndex, int endIndex) {
          endIndex = validateRange(startIndex, endIndex);
          final int len = endIndex - startIndex;
          if (len == 0) {
              return ArrayUtils.EMPTY_CHAR_ARRAY;
          }
          final char chars[] = new char[len];
          System.arraycopy(buffer, startIndex, chars, 0, len);
          return chars;
      }
docs: Copies part of the builder's character array into a new character array.
  
  @param startIndex  the start index, inclusive, must be valid
  @param endIndex  the end index, exclusive, must be valid except that
  if too large it is treated as end of string
  @return a new array that holds part of the contents of the builder
  @throws IndexOutOfBoundsException if startIndex is invalid,
  or if endIndex is invalid (but endIndex greater than size is valid)