public static int solve ( int n , int [ ] nums ) {
  while ( n >= 0 ) {
    for ( int i = 0 ;
    i < nums . length ;
    i ++ ) {
      if ( n > 0 ) {
        n -= nums [ i ] ;
        if ( n <= 0 ) {
          return i + 1 ;
        }
      }
    }
  }
  return 0 ;
}

public static int solve ( int n , int [ ] nums ) { while ( n >= 0 ) { for ( int i = 0 ; i < nums . length ; i ++ ) { if ( n > 0 ) { n -= nums [ i ] ; if ( n <= 0 ) { return i + 1 ; } } } } return 0 ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier))) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (identifier) right: (decimal_integer_literal))))))))))) (return_statement (decimal_integer_literal))))