public TreeNode createBinaryTree(Integer[] array){
        if(array.length==0){
            return null;
        }
        if(array.length==1){
            return new TreeNode(array[0]);
        }
        TreeNode root = new TreeNode(array[0]);
        Queue<TreeNode> graphStack = new ArrayDeque<TreeNode>();
        graphStack.add(root);

        for(int i=1; i<array.length; i=i+2){
            TreeNode current = graphStack.poll();
            TreeNode left = new TreeNode(array[i]);
            current.left = left;
            graphStack.add(left);
            if(array.length>i+1){
                TreeNode right = new TreeNode(array[i+1]);
                current.right = right;
                graphStack.add(right);
            }
        }
        return root;
    }