Iterate until queue is empty
while ( len > 0 ) { TreeNode temp = que . peek ( ) ; que . poll ( ) ; System . out . print ( temp . val + " ▁ " ) ; if ( temp . left != null ) que . add ( temp . left ) ; if ( temp . right != null ) que . add ( temp . right ) ; len -= 1 ; } System . out . println ( ) ; } System . out . println ( ) ; }