public static BigDecimal f ( int index ) {
  if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ;
  else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ;
}

public static BigDecimal f ( int index ) { if ( index == n ) return BigDecimal . valueOf ( a [ index ] ) . divide ( BigDecimal . ONE , 45 , BigDecimal . ROUND_HALF_DOWN ) ; else return BigDecimal . valueOf ( a [ index ] ) . add ( BigDecimal . ONE . divide ( f ( index + 1 ) , 45 , BigDecimal . ROUND_HALF_DOWN ) ) ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) name: (identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)) (decimal_integer_literal) (field_access object: (identifier) field: (identifier))))) alternative: (return_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) name: (identifier) arguments: (argument_list (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) (decimal_integer_literal) (field_access object: (identifier) field: (identifier))))))))))