code: public static Geometry updateZ(Geometry geometry, double z, int updateCondition) throws SQLException {
          if(geometry == null){
              return null;
          }
          if (updateCondition == 1 || updateCondition == 2 || updateCondition == 3) {
              Geometry outPut = geometry.copy();
              outPut.apply(new UpdateZCoordinateSequenceFilter(z, updateCondition));
              return outPut;
          } else {
              throw new SQLException("Available values are 1, 2 or 3.\n"
                      + "Please read the description of the function to use it.");
          }
      }
docs: Replace the z value depending on the condition.
  
  @param geometry
  @param z
  @param updateCondition set if the NaN value must be updated or not
  @return
  @throws java.sql.SQLException