Merge pull request #9768 from tweimer/patch-1
Replace StringBuffer with StringBuilder and add initial capacity
This commit is contained in:
commit
0aebf12bb9
@ -3,7 +3,7 @@ package com.baeldung.hashing;
|
|||||||
class SHACommonUtils {
|
class SHACommonUtils {
|
||||||
|
|
||||||
public static String bytesToHex(byte[] hash) {
|
public static String bytesToHex(byte[] hash) {
|
||||||
StringBuffer hexString = new StringBuffer();
|
StringBuilder hexString = new StringBuilder(2 * hash.length);
|
||||||
for (byte h : hash) {
|
for (byte h : hash) {
|
||||||
String hex = Integer.toHexString(0xff & h);
|
String hex = Integer.toHexString(0xff & h);
|
||||||
if (hex.length() == 1)
|
if (hex.length() == 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user