code: public static String getCodeFromCrs( CoordinateReferenceSystem crs ) throws Exception {
          String code = null;
          try {
              Integer epsg = CRS.lookupEpsgCode(crs, true);
              code = "EPSG:" + epsg; //$NON-NLS-1$
          } catch (Exception e) {
              // try non epsg
              code = CRS.lookupIdentifier(crs, true);
          }
          return code;
      }
docs: Get the code from a {@link CoordinateReferenceSystem}.
  
  @param crs the crs to get the code from.
  
  @return the code, that can be used with {@link CRS#decode(String)} to recreate the crs.
  
  @throws Exception