public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) {
    	ArrayList<ArrayList<Integer>> order = new ArrayList<ArrayList<Integer>>();
    	if (root == null)
    		return order;
    	
    	Queue<TreeNode> queue = new LinkedList<TreeNode>();
    	queue.offer(root);
    	int currentLevelCount = 0;
    	int nextLevelCount = 1;
    	
    	while (queue.size() > 0){
    		ArrayList<Integer> level = new ArrayList<Integer>();
    		currentLevelCount = nextLevelCount;
    		nextLevelCount = 0;
    		for (int i = 0; i < currentLevelCount; i++) {
				
    			TreeNode node = queue.poll();
				level.add(node.val);
				
				if (node.left != null){
					queue.offer(node.left);
					nextLevelCount++;
				}
				
				if (node.right != null){
					queue.offer(node.right);
					nextLevelCount++;
				}
    			
    		}
    		order.add(level);
    		level = new ArrayList<Integer>();    		
    	}
    	
    	
    	return order;
    }