public Double evaluate() {
        String[] formulas = decodeFormula();
        String operatorString = "*/+-";

        for (String formula : formulas) {
            if ("(".equals(formula))
                continue;

            if (operatorString.contains(formula))
                operators.push(formula);
            else if (!")".equals(formula))
                values.push(Double.valueOf(formula));
            else {
                String operator = operators.pop();
                Double v1 = values.pop();
                Double v2 = values.pop();
                Double v3 = null;
                if ("+".equals(operator))
                    v3 = v1 + v2;
                else if ("-".equals(operator))
                    v3 = v2 - v1;
                else if ("*".equals(operator))
                    v3 = v2 * v1;
                else
                    v3 = v2 / v1;
                values.push(v3);
            }

        }
        return values.pop();
    }