X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/2ab70edc68eddbd8e20a0956ad0fec0982e45323..0624d6a808b8b2a247aadd96450319bc94e3729f:/src/main/java/org/asamk/signal/util/Hex.java diff --git a/src/main/java/org/asamk/signal/util/Hex.java b/src/main/java/org/asamk/signal/util/Hex.java index 95b2d26f..46609ceb 100644 --- a/src/main/java/org/asamk/signal/util/Hex.java +++ b/src/main/java/org/asamk/signal/util/Hex.java @@ -2,13 +2,20 @@ package org.asamk.signal.util; 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 final static 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) { + StringBuffer buf = new StringBuffer(); + for (final byte aByte : bytes) { + appendHexChar(buf, aByte); + buf.append(" "); + } + return buf.toString(); + } + public static String toStringCondensed(byte[] bytes) { StringBuffer buf = new StringBuffer(); for (final byte aByte : bytes) { @@ -20,7 +27,6 @@ public class Hex { private static void appendHexChar(StringBuffer buf, int b) { buf.append(HEX_DIGITS[(b >> 4) & 0xf]); buf.append(HEX_DIGITS[b & 0xf]); - buf.append(" "); } public static byte[] toByteArray(String s) {