code: private static void checkOffsetAndCount(final int length, final int offset, final int count) {
      if (offset < 0 || count < 0 || offset + count > length) {
        throw new IndexOutOfBoundsException();
      }
    }
docs: Validates the offset and the byte count for the given array length.
  
  @param length Length of the array to be checked.
  @param offset Starting offset in the array.
  @param count Total number of elements to be accessed.
  @throws IndexOutOfBoundsException if {@code offset} is negative, {@code count} is negative or
  their sum exceeds the given {@code length}.