code: public static Geometry force3D(Geometry geom) {
          if (geom == null) {
              return null;
          }
          return GeometryCoordinateDimension.force(geom, 3); 
      }
docs: Converts a XY geometry to XYZ. If a geometry has no Z component, then a 0
  Z coordinate is tacked on.
  
  @param geom
  @return