code: public static Double st3darea(Geometry geometry) {
          if (geometry == null) {
              return null;
          }
          double area = 0;
          for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
              Geometry subGeom = geometry.getGeometryN(idPoly);
              if (subGeom instanceof Polygon) {
                  area += compute3DArea((Polygon) subGeom);
              }
          }
          return area;
      }
docs: Compute the 3D area of a polygon a geometrycollection that contains
  polygons
  
  @param geometry
  @return