private static int lastNonSeparatorIndex(@NotNull String path) {
    for (int index = path.length() - 1; index >= 0; --index) {
      char c = path.charAt(index);
      if (!isSeparator(c)) {
        return index;
      }
    }
    return -1;
  }
private static int lastNonSeparatorIndex(@NotNull String path)