Added bytesToHex converter
This commit is contained in:
parent
c016da10fd
commit
3ba1463936
15
src/main/java/Main/Utils.java
Normal file
15
src/main/java/Main/Utils.java
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user