static double [ ] find_Centroid ( double v [ ] [ ] ) {
  double [ ] ans = new double [ 2 ] ;
  int n = v . length ;
  double signedArea = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    double x0 = v [ i ] [ 0 ] , y0 = v [ i ] [ 1 ] ;
    double x1 = v [ ( i + 1 ) % n ] [ 0 ] , y1 = v [ ( i + 1 ) % n ] [ 1 ] ;
    double A = ( x0 * y1 ) - ( x1 * y0 ) ;
    signedArea += A ;
    ans [ 0 ] += ( x0 + x1 ) * A ;
    ans [ 1 ] += ( y0 + y1 ) * A ;
  }
  signedArea *= 0.5 ;
  ans [ 0 ] = ( ans [ 0 ] ) / ( 6 * signedArea ) ;
  ans [ 1 ] = ( ans [ 1 ] ) / ( 6 * signedArea ) ;
  return ans ;
}

static double [ ] find_Centroid ( double v [ ] [ ] ) { double [ ] ans = new double [ 2 ] ; int n = v . length ; double signedArea = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double x0 = v [ i ] [ 0 ] , y0 = v [ i ] [ 1 ] ; double x1 = v [ ( i + 1 ) % n ] [ 0 ] , y1 = v [ ( i + 1 ) % n ] [ 1 ] ; double A = ( x0 * y1 ) - ( x1 * y0 ) ; signedArea += A ; ans [ 0 ] += ( x0 + x1 ) * A ; ans [ 1 ] += ( y0 + y1 ) * A ; } signedArea *= 0.5 ; ans [ 0 ] = ( ans [ 0 ] ) / ( 6 * signedArea ) ; ans [ 1 ] = ( ans [ 1 ] ) / ( 6 * signedArea ) ; return ans ; }
(method_declaration (modifiers) type: (array_type element: (floating_point_type) dimensions: (dimensions)) name: (identifier) parameters: (formal_parameters (formal_parameter type: (floating_point_type) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (array_type element: (floating_point_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (floating_point_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) index: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) index: (decimal_integer_literal)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_floating_point_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (array_access array: (identifier) index: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (parenthesized_expression (array_access array: (identifier) index: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier)))))) (return_statement (identifier))))