private static int computeEscapeUnicode(String input, int cursor, StringBuilder builder) {
		// Bounds check
		if (cursor + 1 >= input.length()) {
			return 0;
		}

		// Check for double backslash in prefix "\\\\u" in "\\\\uXXXX"
		char c1 = input.charAt(cursor);
		char c2 = input.charAt(cursor + 1);
		boolean initialEscape = c1 == '\\' && c2 == '\\';

		// Check prefix "\\u" in "\\uXXXX"
		if (!initialEscape && (c1 != '\\' || c2 != 'u')) {
			return 0;
		}

		// Compute escape size, initial is 2 for the "\\u"
		final int initialLen = 2;
		int len = initialLen;

		// Combined:
		// - Bounds check
		// - Case check for "\\uuXXXX" where 'u' is repeated
		while (cursor + len < input.length() && input.charAt(cursor + len) == 'u') {
			len++;
		}

		// Combined:
		// - Bounds check
		// - Case check for "\\u+XXXX" format
		if (cursor + len < input.length() && input.charAt(cursor + len) == '+') {
			len += 1;
		}

		// Bounds check, then fetch hex value and store in builder, then return total consumed length
		if (cursor + len + 4 <= input.length()) {
			String existing = input.substring(cursor, cursor + len + 4);
			if (initialEscape) {
				// Keep the '\\uXXXX' format.
				builder.append(existing);
			} else {
				String unicode = input.substring(cursor + len, cursor + len + 4);
				try {
					int value = Integer.parseInt(unicode, 16);
					builder.append(value != TERMINATOR ? (char) value : existing);
				} catch (NumberFormatException ignored) {
					return 0;
				}
			}
			return len + 4;
		}

		// If we didn't see any recognized pattern, just escape "\\\\" into "\\"
		if (initialEscape && len == initialLen) {
			return 1;
		}

		return 0;
	}
Replaces standard escape codes with literal values.
<br>
For example: {@code \n}, {@code \r}, {@code \t}, {@code \}, and {@code "}

@param input
		Input text.

@return String with escaped characters.
recaf-core/src/main/java/software/coley/recaf/util/EscapeUtil.java