public static Stack<Integer> sortStack(Stack<Integer> stack) {
		Stack<Integer> buffer = new Stack<Integer>();

		while (!stack.isEmpty()) {
			int temp = stack.pop();

			while (!buffer.isEmpty() && buffer.peek() >= temp) {
				stack.push(buffer.pop());
			}
			buffer.push(temp);
		}
		return buffer;
	}