package org.argeo.util;
-import static org.argeo.util.BytesUtils.toHexString;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
}
}
- /** @deprecated Use {@link BytesUtils#toHexString(byte[])} instead */
- @Deprecated
- public static String encodeHexString(byte[] bytes) {
- return BytesUtils.toHexString(bytes);
+ final private static char[] hexArray = "0123456789abcdef".toCharArray();
+
+ /** Converts a byte array to an hex String. */
+ public static String toHexString(byte[] bytes) {
+ char[] hexChars = new char[bytes.length * 2];
+ for (int j = 0; j < bytes.length; j++) {
+ int v = bytes[j] & 0xFF;
+ hexChars[j * 2] = hexArray[v >>> 4];
+ hexChars[j * 2 + 1] = hexArray[v & 0x0F];
+ }
+ return new String(hexChars);
}
}