private Node<T> fromPreIn(T[] preorder, int preStart, int preEnd, T[] inorder, int inStart,
                              int inEnd)
    {
        if (preEnd < preStart || inEnd < inStart || preStart >= preorder.length
            || inStart >= inorder.length)
        {
            return null;
        }
        Node<T> node = new Node<T>(preorder[preStart]);
        int ii;
        for (ii = 0; ii <= inEnd - inStart; ii++) {
            if (inorder[inStart + ii].compareTo(preorder[preStart]) == 0) {
                break;
            }
        }
        node.setLeft(fromPreIn(preorder, preStart + 1, preStart + ii, inorder, inStart, inStart
                                                                                        + ii - 1));
        node.setRight(fromPreIn(preorder, preStart + ii + 1, preEnd, inorder, inStart + ii + 1,
            inEnd));
        return node;
    }