public static ArrayList<LinkedList<TreeNode>> createLevelLinkedList2(TreeNode root) {
        ArrayList<LinkedList<TreeNode>> result = new ArrayList<LinkedList<TreeNode>>();
        Queue<TreeNode> q = new LinkedList<TreeNode>();
        if (root != null) q.add(root);
        while(!q.isEmpty()) {
            int size = q.size();
            LinkedList<TreeNode> level = new LinkedList<TreeNode>();
            for (int i = 0; i < size; ++i) {
                TreeNode n = q.remove();
                level.add(n);
                if (n.left != null) q.add(n.left);
                if (n.right != null) q.add(n.right);
            }
            result.add(level);
        }
        return result;
    }