int (@NotNull String str, int idx) { idx++; int len = str.length(); if (idx >= len || str.charAt(idx) != 'u') return -1; do { idx++; } while (idx < len && str.charAt(idx) == 'u'); if (idx + 3 >= len) return -1; try { int code = Integer.parseInt(str.substring(idx, idx + 4), 16); if (code == '\\') return idx + 4; } catch (NumberFormatException ignored) { } return -1; }