public static boolean dfs ( int now , int parent , int [ ] h , ArrayList < Integer > [ ] table ) {
  boolean exist = h [ now ] == 1 ;
  for ( int next : table [ now ] ) {
    if ( next == parent ) continue ;
    boolean child = dfs ( next , now , h , table ) ;
    if ( child ) ret += 2 ;
    exist |= child ;
  }
  return exist ;
}

public static boolean dfs ( int now , int parent , int [ ] h , ArrayList < Integer > [ ] table ) { boolean exist = h [ now ] == 1 ; for ( int next : table [ now ] ) { if ( next == parent ) continue ; boolean child = dfs ( next , now , h , table ) ; if ( child ) ret += 2 ; exist |= child ; } return exist ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (generic_type (type_identifier) (type_arguments (type_identifier))) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (array_access array: (identifier) index: (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (continue_statement)) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (return_statement (identifier))))