code: public static double length3D(Geometry geom) {
          double sum = 0;
          for (int i = 0; i < geom.getNumGeometries(); i++) {
              sum += length3D((LineString) geom.getGeometryN(i));
  
          }
          return sum;
      }
docs: Returns the 3D length of the given geometry.
  
  @param geom Geometry
  @return The 3D length of the given geometry