int (@NotNull String text, int start) { int ch = text.codePointAt(start); int chLen = Character.charCount(ch); if (!Character.isLetterOrDigit(ch)) { return start + chLen; } int i = start; while (i < text.length()) { int codePoint = text.codePointAt(i); if (!Character.isDigit(codePoint)) break; i += Character.charCount(codePoint); } if (i > start) { // digits form a separate hump return i; } while (i < text.length()) { int codePoint = text.codePointAt(i); if (!Character.isUpperCase(codePoint)) break; i += Character.charCount(codePoint); } if (i > start + chLen) { // several consecutive uppercase letter form a hump if (i == text.length() || !Character.isLetter(text.codePointAt(i))) { return i; } return i - Character.charCount(text.codePointBefore(i)); } if (i == start) i += chLen; while (i < text.length()) { int codePoint = text.codePointAt(i); if (!Character.isLetter(codePoint) || isWordStart(text, i)) break; i += Character.charCount(codePoint); } return i; }