class Utils {

    public static long hexadecimalStringToLong(String s) {
        if (!s.startsWith("0x")) {
            throw new IllegalArgumentException(String.format("Invalid hexadecimal number: %s", s));
        }

        try {
            // Remove leading '0x' before parsing
            return Long.parseLong(s.substring(2), 16);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(String.format("Invalid hexadecimal number: %s", s), e);
        }
    }

}