code: public static String toSingleLineWKT(CoordinateReferenceSystem crs) {
          String wkt = null;
          try {
              // this is a lenient transformation, works with polar stereographics too
              Formattable formattable = (Formattable) crs;
              wkt = formattable.toWKT(0, false);
          } catch (ClassCastException e) {
              wkt = crs.toWKT();
          }
  
          wkt = wkt.replaceAll("\n", "").replaceAll("  ", "");
          return wkt;
      }
docs: Turns the CRS into a single line WKT
  
  @param crs CoordinateReferenceSystem which should be formatted
  @return Single line String which can be written to PRJ file