public static int calc ( String S ) {
  String [ ] s = S . split ( "" ) ;
  int count = 0 ;
  for ( int i = 0 ;
  i < 3 ;
  i ++ ) {
    if ( s [ i ] . equals ( "1" ) ) {
      count ++ ;
    }
  }
  return count ;
}

public static int calc ( String S ) { String [ ] s = S . split ( " " ) ; int count = 0 ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( s [ i ] . equals ( "1" ) ) { count ++ ; } } return count ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (update_expression (identifier))))))) (return_statement (identifier))))