### Question:
GeoUtils { public static GeoCoordinate getCenterOfMinimumDistance(Collection<? extends GeoCoordinate> coordinates) { Validate.notEmpty(coordinates, "coordinates must not be empty"); if (coordinates.size() == 1) { return CollectionHelper.getFirst(coordinates); } GeoCoordinate currentPoint = getMidpoint(coordinates); double minimumDistance = 0; for (GeoCoordinate coordinate : coordinates) { minimumDistance += currentPoint.distance(coordinate); } for (GeoCoordinate coordinate1 : coordinates) { double currentDistance = 0; for (GeoCoordinate coordinate2 : coordinates) { currentDistance += coordinate1.distance(coordinate2); } if (currentDistance < minimumDistance) { minimumDistance = currentDistance; currentPoint = coordinate1; } } double testDistance = EARTH_RADIUS_KM * Math.PI / 2; boolean foundNewSmallest = false; int iterations = 0; while (iterations++ < 5000 && (foundNewSmallest || testDistance >= 2.0e-8 * EARTH_RADIUS_KM)) { GeoCoordinate[] testPoints = getTestPoints(currentPoint, testDistance); double tempMinimumDistance = Double.MAX_VALUE; GeoCoordinate tempCurrentPoint = null; for (GeoCoordinate testPoint : testPoints) { double currentDistance = 0; for (GeoCoordinate coordinate : coordinates) { currentDistance += testPoint.distance(coordinate); } if (currentDistance < tempMinimumDistance) { tempMinimumDistance = currentDistance; tempCurrentPoint = testPoint; } } if (tempMinimumDistance < minimumDistance) { currentPoint = tempCurrentPoint; minimumDistance = tempMinimumDistance; foundNewSmallest = true; } else { testDistance /= 2; foundNewSmallest = false; } } return currentPoint; } private  GeoUtils(); static GeoCoordinate getMidpoint(Collection<? extends GeoCoordinate> coordinates); static GeoCoordinate getCenterOfMinimumDistance(Collection<? extends GeoCoordinate> coordinates); static double parseDms(String dmsString); static double approximateDistance(double lat1, double lng1, double lat2, double lng2); static double approximateDistance(GeoCoordinate c1, GeoCoordinate c2); static double computeDistance(double lat1, double lng1, double lat2, double lng2); static boolean isValidCoordinateRange(double lat, double lng); static void validateCoordinateRange(double lat, double lng); static double normalizeLatitude(double lat); static double normalizeLongitude(double lng); static double getLargestDistance(Collection<? extends GeoCoordinate> coordinates); static final String DMS; static final double EARTH_RADIUS_KM; static final double EARTH_CIRCUMFERENCE_KM; static final double EARTH_MAX_DISTANCE_KM; static final Distance<GeoCoordinate> DISTANCE; }### Answer:
@Test public void testCenterOfMinimumDistance() { GeoCoordinate center = GeoUtils.getCenterOfMinimumDistance(coordinates1); assertEquals(48.337076, center.getLatitude(), 0.01); assertEquals(7.758056, center.getLongitude(), 0.01); center = GeoUtils.getCenterOfMinimumDistance(coordinates3); assertEquals(new ImmutableGeoCoordinate(52.52437, 13.41053), center); center = GeoUtils.getCenterOfMinimumDistance(coordinates4); assertEquals(52.52425, center.getLatitude(), 0.01); assertEquals(-5.220439, center.getLongitude(), 0.01); }