public void printStack(Stack<Integer> stack) {
		Stack<Integer> tmpStack = new Stack<Integer>();

		// pop all and print
		while (!stack.empty()) {
			int cur = stack.pop();
			System.out.println(cur);
			tmpStack.push(cur);
		}

		// put it back
		while (!tmpStack.empty()) {
			stack.push(tmpStack.pop());
		}
	}