Merge pull request #9768 from tweimer/patch-1

Replace StringBuffer with StringBuilder and add initial capacity
This commit is contained in:
Loredana Crusoveanu 2020-10-16 19:02:17 +03:00 committed by GitHub
commit 0aebf12bb9

View File

@ -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)