code: public static void checkOffsetAndCount(final char[] buffer, final int charOffset,
        final int charCount) {
      // Ensure we throw a NullPointerException instead of a JavascriptException in case the
      // given buffer is null.
      if (buffer == null) {
        throw new NullPointerException();
      }
      checkOffsetAndCount(buffer.length, charOffset, charCount);
    }
docs: Validates the offset and the byte count for the given array of characters.
  
  @param buffer Array of characters to be checked.
  @param charOffset Starting offset in the array.
  @param charCount Total number of characters to be accessed.
  @throws NullPointerException if the given reference to the buffer is null.
  @throws IndexOutOfBoundsException if {@code charOffset} is negative, {@code charCount} is
  negative or their sum exceeds the buffer length.