public int evalRPN(String[] tokens) {

	Stack<Integer> stack = new Stack<Integer>();

	for (String token : tokens) {
	    if (isNum(token)) {
		stack.push(Integer.parseInt(token));
	    } else {
		int result = calc(token, stack);
		stack.push(result);
	    }
	}

	if (stack.size() == 1) {
	    return stack.pop();
	} else {
	    return 0;
	}
    }