private static int root ( int [ ] parentIds , int c ) {
  while ( c != parentIds [ c ] ) {
    parentIds [ c ] = parentIds [ parentIds [ c ] ] ;
    c = parentIds [ c ] ;
  }
  return c ;
}

private static int root ( int [ ] parentIds , int c ) { while ( c != parentIds [ c ] ) { parentIds [ c ] = parentIds [ parentIds [ c ] ] ; c = parentIds [ c ] ; } return c ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))))) (return_statement (identifier))))