Update SHACommonUtils.java
Replace StringBuffer with StringBuilder and add initial capacity. StringBuilder is faster because it is not synchronized.
This commit is contained in:
parent
6db8bd17a0
commit
3718d15004
|
@ -3,7 +3,7 @@ package com.baeldung.hashing;
|
|||
class SHACommonUtils {
|
||||
|
||||
public static String bytesToHex(byte[] hash) {
|
||||
StringBuffer hexString = new StringBuffer();
|
||||
StringBuilder hexString = new StringBuilder(2 * hash.length);
|
||||
for (byte h : hash) {
|
||||
String hex = Integer.toHexString(0xff & h);
|
||||
if (hex.length() == 1)
|
||||
|
|
Loading…
Reference in New Issue