public static boolean method ( int [ ] arr ) {
  boolean flag = true ;
  for ( int i = 1 ;
  i < arr . length ;
  i += 2 ) {
    if ( arr [ i ] < arr [ i - 1 ] ) {
      int temp = arr [ i ] ;
      arr [ i ] = arr [ i - 1 ] ;
      arr [ i - 1 ] = temp ;
    }
  }
  for ( int i = 2 ;
  i < arr . length ;
  i += 2 ) {
    if ( arr [ i ] > arr [ i - 1 ] ) {
      int temp = arr [ i ] ;
      arr [ i ] = arr [ i - 1 ] ;
      arr [ i - 1 ] = temp ;
    }
  }
  for ( int i = 1 ;
  i < arr . length ;
  i ++ ) {
    if ( i % 2 != 0 && arr [ i ] < arr [ i - 1 ] ) flag = false ;
    else if ( i % 2 == 0 && arr [ i ] > arr [ i - 1 ] ) flag = false ;
  }
  return flag ;
}

public static boolean method ( int [ ] arr ) { boolean flag = true ; for ( int i = 1 ; i < arr . length ; i += 2 ) { if ( arr [ i ] < arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 2 ; i < arr . length ; i += 2 ) { if ( arr [ i ] > arr [ i - 1 ] ) { int temp = arr [ i ] ; arr [ i ] = arr [ i - 1 ] ; arr [ i - 1 ] = temp ; } } for ( int i = 1 ; i < arr . length ; i ++ ) { if ( i % 2 != 0 && arr [ i ] < arr [ i - 1 ] ) flag = false ; else if ( i % 2 == 0 && arr [ i ] > arr [ i - 1 ] ) flag = false ; } return flag ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (assignment_expression left: (identifier) right: (decimal_integer_literal)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (expression_statement (assignment_expression left: (identifier) right: (false))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) consequence: (expression_statement (assignment_expression left: (identifier) right: (false))))))) (return_statement (identifier))))