int (char @NotNull [] s, char c, int start, int end, boolean caseSensitive) { end = Math.min(end, s.length); for (int i = Math.max(start, 0); i < end; i++) { boolean ignoreCase = !caseSensitive; if (charsMatch(s[i], c, ignoreCase)) return i; } return -1; }