Added bytesToHex converter

This commit is contained in:
Marcin Kostrzewski 2020-10-28 17:10:59 +01:00
parent c016da10fd
commit 3ba1463936

View File

@ -0,0 +1,15 @@
package Main;
public class Utils {
private static String bytesToHex(byte[] hash) {
StringBuilder hexString = new StringBuilder(2 * hash.length);
for (byte b : hash) {
String hex = Integer.toHexString(0xff & b);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
return hexString.toString();
}
}