public static double length(@NonNull Polygon polygon,
                              @NonNull @TurfConstants.TurfUnitCriteria String units) {
    double len = 0;
    for (List<Point> points : polygon.coordinates()) {
      len += length(points, units);
    }
    return len;
  }
public static double length ( @ NonNull Polygon polygon , @ NonNull @ TurfConstants . TurfUnitCriteria String units ) { double len = 0 ; for ( List < Point > points : polygon . coordinates ( ) ) { len += length ( points , units ) ; } return len ; }
Takes a {@link Polygon} and measures its perimeter in the specified units. if the polygon
contains holes, the perimeter will also be included.

@param polygon geometry to measure
@param units   one of the units found inside {@link TurfConstants.TurfUnitCriteria}
@return total perimeter of the input polygon in the units specified
@see <a href="http://turfjs.org/docs/#linedistance">Turf Line Distance documentation</a>
@since 1.2.0