I need to compute the centroid position of an irregular polygon with lat and lon coordinates in Java. Which formula should I use to correctly compute a centroid?
You could do a lot worse than use the JTS library for this, Look at http://jts-topo-suite.svn.sourceforge.net/viewvc/jts-topo-suite/trunk/jts/java/src/com/vividsolutions/jts/algorithm/CentroidArea.java?revision=488&view=markup for details. From the JavaDocs you can find the algorithm used at http://www.faqs.org/faqs/graphics/algorithms-faq/
Have you looked at the Java Topology Suite (http://www.vividsolutions.com/jts/JTSHome.htm)? If you're not worried about executable size, then this would seem to fit the bill with a minimum of additional code, and a fairly battle tested library. It's under LGPL licence, so hopefully that's suitable.