public static int cal(int v1, int v2, char operator) {
        int ans = 0;
        switch (operator) {
            case '+':
                ans = v1 + v2;
                break;
            case '-':
                ans = v2 - v1;
                break;
            case '*':
                ans = v1 * v2;
                break;
            case '/':
                if (v1 == 0)
                    throw new UnsupportedOperationException();
                ans = v2 / v1;
                break;
            default:
                break;
        }
        return ans;
    }