@@ -0,0 +1,1369 @@
+// SPDX-License-Identifier: MIT%0A// Copyright (C) 2018-present iced project and contributors%0A%0Apackage com.github.icedland.iced.x86;%0A%0Apublic final class HexUtils %7B%0A%09public static byte%5B%5D toByteArray(String hexData) %7B%0A%09%09if (hexData == null)%0A%09%09%09throw new NullPointerException();%0A%09%09if (hexData.length() == 0)%0A%09%09%09return new byte%5B0%5D;%0A%09%09int len = 0;%0A%09%09for (int i = 0; i %3C hexData.length(); i++) %7B%0A%09%09%09if (hexData.charAt(i) != ' ')%0A%09%09%09%09len++;%0A%09%09%7D%0A%09%09byte%5B%5D data = new byte%5Blen / 2%5D;%0A%09%09int w = 0;%0A%09%09for (int i = 0; ;) %7B%0A%09%09%09while (i %3C hexData.length() && Character.isWhitespace(hexData.charAt(i)))%0A%09%09%09%09i++;%0A%09%09%09if (i %3E= hexData.length())%0A%09%09%09%09break;%0A%09%09%09int hi = tryParseHexChar(hexData.charAt(i++));%0A%09%09%09if (hi %3C 0)%0A%09%09%09%09throw new UnsupportedOperationException();%0A%0A%09%09%09while (i %3C hexData.length() && Character.isWhitespace(hexData.charAt(i)))%0A%09%09%09%09i++;%0A%09%09%09if (i %3E= hexData.length())%0A%09%09%09%09throw new UnsupportedOperationException();%0A%09%09%09int lo = tryParseHexChar(hexData.charAt(i++));%0A%09%09%09if (lo %3C 0)%0A%09%09%09%09throw new UnsupportedOperationException();%0A%09%09%09data%5Bw++%5D = (byte)((hi %3C%3C 4) %7C lo);%0A%09%09%7D%0A%09%09if (w != data.length)%0A%09%09%09throw new UnsupportedOperationException();%0A%09%09return data;%0A%09%7D%0A%0A%09private static int tryParseHexChar(char c) %7B%0A%09%09if ('0' %3C= c && c %3C= '9')%0A%09%09%09return c - '0';%0A%09%09if ('A' %3C= c && c %3C= 'F')%0A%09%09%09return c - 'A' + 10;%0A%09%09if ('a' %3C= c && c %3C= 'f')%0A%09%09%09return c - 'a' + 10;%0A%09%09return -1;%0A%09%7D%0A%7D%0A

Add `HexUtils`