code: public static Identifier parse(String stringValue, int desiredByteLength) {
          if (stringValue == null) {
              throw new NullPointerException("Identifiers cannot be constructed from null pointers but \"stringValue\" is null.");
          }
  
          if (HEX_PATTERN.matcher(stringValue).matches()) {
              return parseHex(stringValue.substring(2), desiredByteLength);
          }
  
          if (UUID_PATTERN.matcher(stringValue).matches()) {
              return parseHex(stringValue.replace("-", ""), desiredByteLength);
          }
  
          if (DECIMAL_PATTERN.matcher(stringValue).matches()) {
              int value = -1;
              try {
                  value = Integer.valueOf(stringValue);
              }
              catch (Throwable t) {
                  throw new IllegalArgumentException("Unable to parse Identifier in decimal format.", t);
              }
              if (desiredByteLength <= 0 || desiredByteLength == 2) {
                  return fromInt(value);
              }
              else {
                  return fromLong(value, desiredByteLength);
              }
          }
  
          if (HEX_PATTERN_NO_PREFIX.matcher(stringValue).matches()) {
              return parseHex(stringValue, desiredByteLength);
          }
  
          throw new IllegalArgumentException("Unable to parse Identifier.");
      }
docs: Variant of the parse method that allows specifying the byte length of the identifier.
  @see #parse(String)
  @param stringValue
  @param desiredByteLength
  @return