class LuaUtils {

    /**
     * Private to enforce singleton.
     */
    private  LuaUtils() {
    }

    /**
     * Counts the level of a Lua opening long bracket specified in
     * {@code capture}.
     * @param capture the opening long bracket
     * @return the bracket level
     */
    public static int countOpeningLongBracket(String capture) {
        if (!capture.startsWith("[") || !capture.endsWith("[")) {
            throw new IllegalArgumentException(
                "Invalid opening long bracket: " + capture);
        }

        int n = 0;
        for (int i = 1; i + 1 < capture.length(); ++i) {
            if (capture.charAt(i) != '=') {
                throw new IllegalArgumentException(
                    "Invalid opening long bracket: " + capture);
            }
            ++n;
        }
        return n;
    }

    /**
     * Determines if the specified {@code capture} is a closing long bracket of
     * the specified {@code level}.
     * @param capture the possible Lua closing long bracket
     * @param level the required level of closing long bracket
     * @return true if the {@code capture} is determined to be the required
     * closing long bracket or false otherwise.
     */
    public static boolean isClosingLongBracket(String capture, int level) {<FILL_FUNCTION_BODY>}
}

        if (!capture.startsWith("]") || !capture.endsWith("]")) {
            throw new IllegalArgumentException(
                "Invalid opening long bracket: " + capture);
        }

        int n = 0;
        for (int i = 1; i + 1 < capture.length(); ++i) {
            if (capture.charAt(i) != '=') {
                throw new IllegalArgumentException(
                    "Invalid opening long bracket: " + capture);
            }
            ++n;
        }
        return n == level;
    
<no_super_class>