code: public static double length3D(Polygon polygon) {
                  double len = 0.0;
                  len += length3D(polygon.getExteriorRing().getCoordinateSequence());
                  for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
                          len += length3D(polygon.getInteriorRingN(i));
                  }
                  return len;
          }
docs: Returns the 3D perimeter of a polygon
  
  @param polygon
  @return