I am trying to do a level order traversal and want to pass this binary tree 

```
[3,9,20,null,null,15,7]

```

in to the method

```
public List<List<Integer>> levelOrder(TreeNode root) {

```

But this doesn't work.

```
 TreeNode bt = [3,9,20,null,null,15,7];
    levelOrder(bt);

```

This is the levelOrder method

```
public List<List<Integer>> levelOrder(TreeNode root) {
    Queue<TreeNode> queue = new LinkedList<TreeNode>();
    List<List<Integer>> wrapList = new LinkedList<List<Integer>>();

    if(root == null) return wrapList;

    queue.offer(root);
    while(!queue.isEmpty()){
        int levelNum = queue.size();
        List<Integer> subList = new LinkedList<Integer>();
        for(int i=0; i<levelNum; i++) {
            if(queue.peek().left != null) queue.offer(queue.peek().left);
            if(queue.peek().right != null) queue.offer(queue.peek().right);
            subList.add(queue.poll().val);
        }
        wrapList.add(subList);
    }
    return wrapList;
}

```

This is the TreeNode

```
public class TreeNode {
 int val;
 TreeNode left;
 TreeNode right;
 TreeNode(int x) { val = x; }
}

```