A string is known, find the hexadecimal sum of the string, and know a piece of string and check code. Whether the checksum accumulation is legal, I will just go to the code without saying much.
public static String makeChecksum(String data) { if (data == null || data.equals("")) { return ""; } int total = 0; int len = data.length(); int num = 0; while (num < len) { String s = data.substring(num, num + 2); System.out.println(s); total += Integer.parseInt(s, 16); num = num + 2; } /** * Use 256 to find that the maximum remainder is 255, that is, FF in hexadecimal */ int mod = total % 256; String hex = Integer.toHexString(mod); len = hex.length(); // If the length of the check bit is not enough, add 0. Here, two-bit check is used if (len < 2) { hex = "0" + hex; } return hex; }The above article on Java accumulation and verification implementation method hexadecimal (recommended) is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.