private static int count ( final String in , final int length , final char c ) {
  if ( length == 0 ) {
    return 0 ;
  }
  if ( in . charAt ( length - 1 ) == c ) {
    return count ( in , length - 1 , c ) ;
  }
  else {
    return 1 + count ( in , length - 1 , c == '+' ? '-' : '+' ) ;
  }
}

private static int count ( final String in , final int length , final char c ) { if ( length == 0 ) { return 0 ; } if ( in . charAt ( length - 1 ) == c ) { return count ( in , length - 1 , c ) ; } else { return 1 + count ( in , length - 1 , c == ' + ' ? ' - ' : ' + ' ) ; } }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter (modifiers) type: (type_identifier) name: (identifier)) (formal_parameter (modifiers) type: (integral_type) name: (identifier)) (formal_parameter (modifiers) type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier))) consequence: (block (return_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))) alternative: (block (return_statement (binary_expression left: (decimal_integer_literal) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal)) (ternary_expression condition: (binary_expression left: (identifier) right: (character_literal)) consequence: (character_literal) alternative: (character_literal))))))))))