code: public static Double perimeter(Geometry geometry){        
          if(geometry==null){
              return null;
          }
          if(geometry.getDimension()<2){
              return 0d;
          }
          return computePerimeter(geometry);
      }
docs: Compute the perimeter of a polygon or a multipolygon.
  @param geometry
  @return