public Node next() {
        Node node = null;
        while (root1 != null) {
            stack1.push(root1);
            root1 = root1.left;
        }
        while (root2 != null) {
            stack2.push(root2);
            root2 = root2.left;
        }
        if (!stack1.isEmpty() && !stack2.isEmpty()) {
            if (stack1.peek().data <= stack2.peek().data) {
                node = stack1.pop();
                root1 = node.right;
            } else {
                node = stack2.pop();
                root2 = node.right;
            }
        } else if (stack1.isEmpty()) {
            node = stack2.pop();
            root2 = node.right;
        } else {
            node = stack1.pop();
            root1 = node.right;
        }
        return node;
    }
Next inorder iterator of two trees.
Merging tree to print one result
src/com/interview/tree/NextInorderSuccessorOfTwoTree.java