public static boolean isPopOrder(int[] pushOrder, int[] popOrder) {
		if (pushOrder == null || pushOrder.length == 0 || popOrder == null
				|| popOrder.length == 0 || pushOrder.length != popOrder.length) {
			return false;
		}

		int popIndex = 0;
		Stack<Integer> stack = new Stack<Integer>();
		for (int num : pushOrder) {
			stack.push(num);

			while (!stack.isEmpty() && stack.peek() == popOrder[popIndex]) {
				stack.pop();
				popIndex++;
			}
		}

		return stack.isEmpty();
	}