private static @NotNull String badElementIndex(int index, int size, @NotNull String indexDescription) {
    if (index < 0) {
      return indexDescription + " (" + index + ") must not be negative";
    }
    else if (size < 0) {
      throw new IllegalArgumentException("negative size: " + size);
    }
    else { // index >= size
      return indexDescription + " (" + index + ") must be less than size (" + size + ")";
    }
  }
private static @NotNull String badElementIndex(int index, int size, @NotNull String indexDescription)