boolean (@NotNull String s, int firstChar, int lastChar, String @NotNull [] prepositions) { outer: for (String preposition : prepositions) { if (lastChar - firstChar + 1 == preposition.length()) { for (int j = 0; j < preposition.length(); j++) { if (toLowerCase(s.charAt(firstChar + j)) != toLowerCase(preposition.charAt(j))) continue outer; } return true; } } return false; }