public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) {
   
    	ArrayList<ArrayList<Integer>> results = new ArrayList<ArrayList<Integer>>();
    	
    	if(root == null) {
    		return results;
    	}
    	
    	ArrayList<TreeNode> curt = new ArrayList<TreeNode>();
    	curt.add(root);
    	
    	while(!curt.isEmpty()) {
    		ArrayList<TreeNode> next = new ArrayList<TreeNode>();
    		ArrayList<Integer> rst = new ArrayList<Integer>();
    		
    		for(TreeNode node : curt) {
    			rst.add(node.val);
    			if(node.left != null) next.add(node.left);
    			if(node.right != null) next.add(node.right);
    		}
    		
    		results.add(rst);
    		curt = next;    	
    	}
    	
		return results;
    }