static int divisibleby37 ( String n1 ) {
  int l = n1 . length ( ) ;
  if ( n1 == "0" ) return 0 ;
  if ( l % 3 == 1 ) {
    n1 = "00" + n1 ;
    l += 2 ;
  }
  else if ( l % 3 == 2 ) {
    n1 = "0" + n1 ;
    l += 1 ;
  }
  char [ ] n = n1 . toCharArray ( ) ;
  int gSum = 0 ;
  while ( l != 0 ) {
    int gvalue ;
    if ( l == 2 ) gvalue = ( ( int ) n [ ( l - 2 ) ] - 48 ) * 100 + ( ( int ) n [ ( l - 1 ) ] - 48 ) * 10 ;
    else if ( l == 1 ) gvalue = ( ( int ) n [ ( l - 1 ) ] - 48 ) * 100 ;
    else gvalue = ( ( int ) n [ ( l - 3 ) ] - 48 ) * 100 + ( ( int ) n [ ( l - 2 ) ] - 48 ) * 10 + ( ( int ) n [ ( l - 1 ) ] - 48 ) * 1 ;
    l = l - 3 ;
    gSum = gSum + gvalue ;
  }
  if ( gSum >= 1000 ) return ( divisibleby37 ( String . valueOf ( gSum ) ) ) ;
  else return ( gSum % 37 == 0 ) ? 1 : 0 ;
}

static int divisibleby37 ( String n1 ) { int l = n1 . length ( ) ; if ( n1 == "0" ) return 0 ; if ( l % 3 == 1 ) { n1 = "00" + n1 ; l += 2 ; } else if ( l % 3 == 2 ) { n1 = "0" + n1 ; l += 1 ; } char [ ] n = n1 . toCharArray ( ) ; int gSum = 0 ; while ( l != 0 ) { int gvalue ; if ( l == 2 ) gvalue = ( ( int ) n [ ( l - 2 ) ] - 48 ) * 100 + ( ( int ) n [ ( l - 1 ) ] - 48 ) * 10 ; else if ( l == 1 ) gvalue = ( ( int ) n [ ( l - 1 ) ] - 48 ) * 100 ; else gvalue = ( ( int ) n [ ( l - 3 ) ] - 48 ) * 100 + ( ( int ) n [ ( l - 2 ) ] - 48 ) * 10 + ( ( int ) n [ ( l - 1 ) ] - 48 ) * 1 ; l = l - 3 ; gSum = gSum + gvalue ; } if ( gSum >= 1000 ) return ( divisibleby37 ( String . valueOf ( gSum ) ) ) ; else return ( gSum % 37 == 0 ) ? 1 : 0 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (string_literal))) consequence: (return_statement (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (string_literal) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal))) right: (binary_expression left: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) right: (decimal_integer_literal))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (return_statement (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))))) alternative: (return_statement (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (decimal_integer_literal) alternative: (decimal_integer_literal))))))