code: public static String asWKT(Geometry geometry) {
          if(geometry==null) {
              return null;
          }
          WKTWriter wktWriter = new WKTWriter();
          return wktWriter.write(geometry);
      }
docs: Convert a Geometry value into a Well Known Text value.
  @param geometry Geometry instance
  @return The String representation