public static void rearrange ( int [ ] arr ) {
  if ( arr == null || arr . length % 2 == 1 ) return ;
  int currIdx = ( arr . length - 1 ) / 2 ;
  while ( currIdx > 0 ) {
    int count = currIdx , swapIdx = currIdx ;
    while ( count -- > 0 ) {
      int temp = arr [ swapIdx + 1 ] ;
      arr [ swapIdx + 1 ] = arr [ swapIdx ] ;
      arr [ swapIdx ] = temp ;
      swapIdx ++ ;
    }
    currIdx -- ;
  }
}

public static void rearrange ( int [ ] arr ) { if ( arr == null || arr . length % 2 == 1 ) return ; int currIdx = ( arr . length - 1 ) / 2 ; while ( currIdx > 0 ) { int count = currIdx , swapIdx = currIdx ; while ( count -- > 0 ) { int temp = arr [ swapIdx + 1 ] ; arr [ swapIdx + 1 ] = arr [ swapIdx ] ; arr [ swapIdx ] = temp ; swapIdx ++ ; } currIdx -- ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (null_literal)) right: (binary_expression left: (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal)) right: (decimal_integer_literal)))) consequence: (return_statement)) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (field_access object: (identifier) field: (identifier)) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier)) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))))) (expression_statement (update_expression (identifier)))))))