private int calculate(int op1, int op2, String operator) {
        if (operator.equals("+")) {
            return op1 + op2;
        }
        else if (operator.equals("-")) {
            return op1 - op2;
        }
        else if (operator.equals("*")) {
            return op1 * op2;
        }
        else if (operator.equals("/")) {
            return (int)(op1 / op2);
        }
        else {
            return 1;
        }
    }