public class Hex {
- private final static char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ private static final char[] HEX_DIGITS = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
private Hex() {
}
public static String toString(byte[] bytes) {
+ if (bytes.length == 0) {
+ return "";
+ }
+
var buf = new StringBuffer();
for (final var aByte : bytes) {
appendHexChar(buf, aByte);
buf.append(" ");
}
+ buf.deleteCharAt(buf.length() - 1);
return buf.toString();
}