public int @NotNull [] findAllOccurrences(@NotNull CharSequence text) {
    int end = text.length();
    IntList result = new IntArrayList();
    for (int index = 0; index < end; index++) {
      //noinspection AssignmentToForLoopParameter
      index = scan(text, index, end);
      if (index < 0) break;
      result.add(index);
    }
    return result.toIntArray();
  }
public int @NotNull [] findAllOccurrences(@NotNull CharSequence text)