class MapperUtils {

  public static UnresolvedAddress toUnresolvedAddress(String hex) {
    if (hex == null) {
      return null;
    }
    // If bit 0 of byte 0 is not set (like in 0x90), then it is a regular address.
    // Else (e.g. 0x91) it represents a namespace id which starts at byte 1.
    byte bit0 = ConvertUtils.getBytes(hex.substring(1, 3))[0];
    if ((bit0 & 16) == 16) {
      // namespaceId encoded hexadecimal notation provided
      // only 8 bytes are relevant to resolve the NamespaceId
      return MapperUtils.toNamespaceId(ConvertUtils.reverseHexString(hex.substring(2, 18)));
    } else {
      return Address.createFromEncoded(hex);
    }
  }

  private  MapperUtils();

}