@@ -0,0 +1,1170 @@
+/* Print a binary tree by level.%0A * */%0A%0Aimport java.util.Queue;%0Aimport java.util.List;%0Aimport java.util.LinkedList;%0A%0Apublic class P0410 %7B%0A  private class Node %7B%0A    int value;%0A    Node left, right;%0A%0A    public Node(int value) %7B%0A      this.value = value;%0A    %7D%0A  %7D%0A%0A  public void printByLevel(Node root) %7B%0A    if (root == null)%0A      return;%0A%0A    Node tmp = null;%0A    Queue%3CNode%3E queue = new LinkedList%3CNode%3E();%0A    queue.offer(root);%0A%0A    while (queue.size() %3E 0) %7B%0A      tmp = queue.poll();%0A      System.out.print(tmp.value + %22 %22);%0A%0A      if (tmp.left != null)%0A        queue.offer(tmp.left);%0A      if (tmp.right != null)%0A        queue.offer(tmp.right);%0A    %7D%0A%0A    System.out.println();%0A  %7D%0A%0A  public Node buildTree() %7B%0A    Node root = new Node(1);%0A    root.left = new Node(2);%0A    root.right = new Node(3);%0A    root.left.left = new Node(4);%0A    root.left.right = new Node(5);%0A    root.right.left = new Node(6);%0A    root.left.left.left = new Node(7);%0A    root.left.left.left.left = new Node(8);%0A    //%0A    return root;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    P0410 p0410 = new P0410();%0A    Node root = p0410.buildTree();%0A%0A    p0410.printByLevel(root);%0A  %7D%0A%7D%0A

print a binary tree by level