private int getResult(String operator, int leftVal, int rightVal) {
        if (operator.equals("+")) {
            return leftVal + rightVal;
        }
        if (operator.equals("-")) {
            return leftVal - rightVal;
        }
        if (operator.equals("*")) {
            return leftVal * rightVal;
        }
        if (operator.equals("/")) {
            return leftVal / rightVal;
        }
        return -1;
    }