private static int mergeSortAndCount ( int [ ] arr , int l , int r ) {
  int count = 0 ;
  if ( l < r ) {
    int m = ( l + r ) / 2 ;
    count += mergeSortAndCount ( arr , l , m ) ;
    count += mergeSortAndCount ( arr , m + 1 , r ) ;
    count += mergeAndCount ( arr , l , m , r ) ;
  }
  return count ;
}

private static int mergeSortAndCount ( int [ ] arr , int l , int r ) { int count = 0 ; if ( l < r ) { int m = ( l + r ) / 2 ; count += mergeSortAndCount ( arr , l , m ) ; count += mergeSortAndCount ( arr , m + 1 , r ) ; count += mergeAndCount ( arr , l , m , r ) ; } return count ; }
(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: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))))) (return_statement (identifier))))