private int[] stringToVersion(String str) throws RegistryFormatException {
    str = str.trim();
    if (str.equalsIgnoreCase("unspecified")) {
      return null;
    }
    else {
      int i, pos, pos2;
      for (i = 0, pos = 0; 
           (pos = str.indexOf('.', pos)) != -1; 
           i++, pos++) { 
        /**/ 
      }
      int[] version = new int[i + 1];
      try {
        for (i = 0, pos2 = 0; 
             (pos = str.indexOf('.', pos2)) != -1; 
             i++, pos2 = pos + 1) {
          version[i] = Integer.parseInt(str.substring(pos2, pos));
        }
        version[version.length - 1] = Integer.parseInt(str.substring(pos2));
      }
      catch (NumberFormatException ex) {
        throw new RegistryFormatException("bad version no (\"" + str + "\")");
      }
      return version;
    }
  }