private static int fromHex(@NotNull String str, int pos) {
    char ch = str.charAt(pos);
    if (ch >= '0' && ch <= '9') return ch - '0';
    if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
    if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
    throw new IllegalArgumentException("unsupported char at " + pos + ":" + str);
  }
private static int fromHex(@NotNull String str, int pos)