Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.PointF; public class Main { public static PointF centroidForPoly(PointF[] points) { float centroidX = 0, centroidY = 0; for (PointF point : points) { centroidX += point.x / points.length; centroidY += point.y / points.length; } return new PointF(centroidX, centroidY); } }