private TreeNode rebuild(String[]nodes,int[]index){
        String data=nodes[index[0]++];
        if(data.equals("NULL")) return null;
        TreeNode node=new TreeNode(Integer.parseInt(data));
        if(index[0]<nodes.length){
            TreeNode left=rebuild(nodes,index);
            node.left=left;
        }
        if(index[0]<nodes.length){
            TreeNode right=rebuild(nodes,index);
            node.right=right;
        }
        return node;
    }