public static QuestionCalculation decode(String encodedQuestionCalculation) throws DecodeException {
        QuestionCalculation res;
        if (encodedQuestionCalculation.substring(0, 19).compareTo("#QuestionCalculaion") == 0) {
            res = new QuestionCalculation();
            int i = 19;
            if (encodedQuestionCalculation.charAt(i) == '<') {
                while (encodedQuestionCalculation.charAt(i) != '>') {
                    i++;
                }
                ArrayList<Integer> tmp_opd = decodeOperands(encodedQuestionCalculation.substring(20, i));
                res.setOperands(tmp_opd);

                i++;
                int beginning = i;
                if (encodedQuestionCalculation.charAt(i) == '<') {
                    while (encodedQuestionCalculation.charAt(i) != '>') {
                        i++;
                    }
                    ArrayList<Character> tmp_opt = decodeOperators(encodedQuestionCalculation.substring(beginning + 1, i));
                    assert tmp_opt.size() == tmp_opt.size() + 1 : "incorrect size of operators table";
                    res.setOperators(tmp_opt);

                    i++;
                    beginning = i;
                    if (encodedQuestionCalculation.charAt(i) == '<') {
                        while (encodedQuestionCalculation.charAt(i) != '>') {
                            i++;
                        }
                        int tmp_lth = Integer.valueOf(encodedQuestionCalculation.substring(beginning + 1, i));
                        assert tmp_lth < 0 : "negative length";
                        res.setLength(tmp_lth);

                        i++;
                        encodedQuestionCalculation = encodedQuestionCalculation.substring(i);
                        Question.decode(res, encodedQuestionCalculation);
                    } else {
                        res = null;
                        throw new DecodeException();
                    }
                } else {
                    res = null;
                    throw new DecodeException();
                }
            } else {
                res = null;
                throw new DecodeException();
            }
        } else {
            res = null;
            throw new DecodeException();
        }
        return res;
    }