【fix sonar】MD5Util文件

This commit is contained in:
梁琦涛
2023-03-13 10:35:06 +08:00
parent 2426b120e3
commit 28acd2afd0
@@ -8,7 +8,7 @@ public class MD5Util {
} }
public static String byteArrayToHexString(byte b[]) { public static String byteArrayToHexString(byte[] b) {
StringBuilder resultSb = new StringBuilder(); StringBuilder resultSb = new StringBuilder();
for (int i = 0; i < b.length; i++){ for (int i = 0; i < b.length; i++){
resultSb.append(byteToHexString(b[i])); resultSb.append(byteToHexString(b[i]));
@@ -23,7 +23,7 @@ public class MD5Util {
} }
int d1 = n / 16; int d1 = n / 16;
int d2 = n % 16; int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2]; return HEX_DIGITS[d1] + HEX_DIGITS[d2];
} }
public static String MD5Encode(String origin, String charsetname) { public static String MD5Encode(String origin, String charsetname) {
@@ -42,7 +42,7 @@ public class MD5Util {
return resultString; return resultString;
} }
private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5", private static final String[] HEX_DIGITS = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
} }