private static void getResult ( int n , int arr [ ] ) {
  Arrays . sort ( arr ) ;
  int i = 0 ;
  int newarr [ ] = new int [ n ] ;
  int count = 0 ;
  while ( i <= n - 1 ) {
    newarr [ i ] = arr [ n - 1 - count ] ;
    i ++ ;
    if ( i <= n - 1 ) {
      newarr [ i ] = arr [ count ] ;
      i ++ ;
    }
    count ++ ;
  }
  for ( i = n - 1 ;
  i >= 0 ;
  i -- ) pw . print ( newarr [ i ] + " " ) ;
  pw . println ( ) ;
}

private static void getResult ( int n , int arr [ ] ) { Arrays . sort ( arr ) ; int i = 0 ; int newarr [ ] = new int [ n ] ; int count = 0 ; while ( i <= n - 1 ) { newarr [ i ] = arr [ n - 1 - count ] ; i ++ ; if ( i <= n - 1 ) { newarr [ i ] = arr [ count ] ; i ++ ; } count ++ ; } for ( i = n - 1 ; i >= 0 ; i -- ) pw . print ( newarr [ i ] + " ▁ " ) ; pw . println ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (identifier))))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))))) (expression_statement (update_expression (identifier))))) (for_statement init: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))