code: public static String toGlobusID(String dn, boolean noreverse) {
          if (dn == null) {
              return null;
          }
  
          StringBuilder buf = new StringBuilder();
  
          String[] tokens = dn.split(",");
          if (noreverse) {
              for (int i = 0; i < tokens.length; i++) {
                  String token = tokens[i].trim();
                  if (!token.isEmpty()) {
                      buf.append("/");
                      buf.append(token.trim());
                  }
              }
          } else {
              for (int i = tokens.length - 1; i >= 0; i--) {
                  String token = tokens[i].trim();
                  if (!token.isEmpty()) {
                      buf.append("/");
                      buf.append(token.trim());
                  }
              }
          }
  
          return buf.toString();
      }
docs: Converts DN of the form "CN=A, OU=B, O=C" into Globus
  format "/CN=A/OU=B/O=C" or "/O=C/OU=B/CN=A" depending on the
  <code>noreverse</code> option. If <code>noreverse</code> is true
  the order of the DN components is not reveresed - "/CN=A/OU=B/O=C" is
  returned. If <code>noreverse</code> is false, the order of the
  DN components is reversed - "/O=C/OU=B/CN=A" is returned. <BR>
  This function might return incorrect Globus-formatted ID when one of
  the RDNs in the DN contains commas.
  
  @param dn the DN to convert to Globus format.
  @param noreverse the direction of the conversion.
  @return the converted DN in Globus format.