static String toPostfix(String infix) {
		StringTokenizer s = new StringTokenizer(infix);

		String symbol, postfix = "";
		while (s.hasMoreTokens()) {
			symbol = s.nextToken();
			if (Character.isDigit(symbol.charAt(0)))
				postfix = postfix + " " + (Integer.parseInt(symbol));
			else if (symbol.equals("(")) {
				Character operator = new Character('(');
				operatorStack.push(operator);
			} else if (symbol.equals(")")) {
				while (((Character) operatorStack.peek()).charValue() != '(') {
					postfix = postfix + " " + operatorStack.pop();
				}
				operatorStack.pop();
			} else {
				while (!operatorStack.empty()
						&& !(operatorStack.peek()).equals("(")
						&& prec(symbol.charAt(0)) <= prec(((Character) operatorStack
								.peek()).charValue()))
					postfix = postfix + " " + operatorStack.pop();
				Character operator = new Character(symbol.charAt(0));
				operatorStack.push(operator);
			}
		}
		while (!operatorStack.empty())
			postfix = postfix + " " + operatorStack.pop();
		return postfix;
	}