static void printSortedLevels ( int arr [ ] , int n ) {
  int level = 0 ;
  for ( int i = 0 ;
  i < n ;
  level ++ ) {
    int cnt = ( int ) Math . pow ( 2 , level ) ;
    cnt -= 1 ;
    int j = Math . min ( i + cnt , n - 1 ) ;
    Arrays . sort ( arr , i , j + 1 ) ;
    while ( i <= j ) {
      System . out . print ( arr [ i ] + " " ) ;
      i ++ ;
    }
    System . out . println ( ) ;
  }
}

static void printSortedLevels ( int arr [ ] , int n ) { int level = 0 ; for ( int i = 0 ; i < n ; level ++ ) { int cnt = ( int ) Math . pow ( 2 , level ) ; cnt -= 1 ; int j = Math . min ( i + cnt , n - 1 ) ; Arrays . sort ( arr , i , j + 1 ) ; while ( i <= j ) { System . out . print ( arr [ i ] + " ▁ " ) ; i ++ ; } System . out . println ( ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal))))) (expression_statement (update_expression (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))))