public static int partition ( int [ ] arr , int low , int high ) {
  int pivot = arr [ high ] , pivotloc = low ;
  for ( int i = low ;
  i <= high ;
  i ++ ) {
    if ( arr [ i ] < pivot ) {
      int temp = arr [ i ] ;
      arr [ i ] = arr [ pivotloc ] ;
      arr [ pivotloc ] = temp ;
      pivotloc ++ ;
    }
  }
  int temp = arr [ high ] ;
  arr [ high ] = arr [ pivotloc ] ;
  arr [ pivotloc ] = temp ;
  return pivotloc ;
}

public static int partition ( int [ ] arr , int low , int high ) { int pivot = arr [ high ] , pivotloc = low ; for ( int i = low ; i <= high ; i ++ ) { if ( arr [ i ] < pivot ) { int temp = arr [ i ] ; arr [ i ] = arr [ pivotloc ] ; arr [ pivotloc ] = temp ; pivotloc ++ ; } } int temp = arr [ high ] ; arr [ high ] = arr [ pivotloc ] ; arr [ pivotloc ] = temp ; return pivotloc ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier))) declarator: (variable_declarator name: (identifier) value: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) 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: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))))))) (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: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (return_statement (identifier))))