code: public static Geometry polygonize(Geometry geometry) {
          if(geometry == null){
              return null;
          }
          Polygonizer polygonizer = new Polygonizer();
          polygonizer.add(geometry);
          Collection pols = polygonizer.getPolygons();
          if(pols.isEmpty()){
              return null;
          }
          return FACTORY.createMultiPolygon(GeometryFactory.toPolygonArray(pols));
      }
docs: Creates a GeometryCollection containing possible polygons formed
  from the constituent linework of a set of geometries.
  
  @param geometry
  @return