boolean (@NotNull CharSequence path, int start, int end) { for (int i = end - 1; i >= start; i--) { char c = path.charAt(i); if (isSeparator(c)) { return true; } // contains '.' or '..' surrounded by slashes if (c == '.' && (i == 2 || i == 3 && path.charAt(2) == '.')) { return true; } } return false; }