code: public static GeoPoint calculateCenter(List<GeoPoint> geoPoints) {
          checkNotNull(geoPoints, "geoPoints cannot be null");
          checkArgument(geoPoints.size() > 0, "must have at least 1 geoPoints");
          if (geoPoints.size() == 1) {
              return geoPoints.get(0);
          }
  
          double x = 0.0;
          double y = 0.0;
          double z = 0.0;
          double totalAlt = 0.0;
          int altitudeCount = 0;
          for (GeoPoint geoPoint : geoPoints) {
              double latRad = Math.toRadians(geoPoint.getLatitude());
              double lonRad = Math.toRadians(geoPoint.getLongitude());
              x += Math.cos(latRad) * Math.cos(lonRad);
              y += Math.cos(latRad) * Math.sin(lonRad);
              z += Math.sin(latRad);
  
              if (geoPoint.getAltitude() != null) {
                  totalAlt += geoPoint.getAltitude();
                  altitudeCount++;
              }
          }
  
          x = x / (double) geoPoints.size();
          y = y / (double) geoPoints.size();
          z = z / (double) geoPoints.size();
  
          return new GeoPoint(
              Math.toDegrees(Math.atan2(z, Math.sqrt(x * x + y * y))),
              Math.toDegrees(Math.atan2(y, x)),
              altitudeCount == geoPoints.size() ? (totalAlt / (double) altitudeCount) : null
          );
      }
docs: For large distances center point calculation has rounding errors