01: package org.jbpm.util;
02:
03: public abstract class ByteUtil {
04:
05: public static String toString(byte[] bytes) {
06: if (bytes == null)
07: return "null";
08: if (bytes.length == 0)
09: return "[]";
10: StringBuffer buf = new StringBuffer();
11: buf.append("[");
12: for (int i = 0; i < bytes.length; i++) {
13: String hexStr = Integer.toHexString(bytes[i]
14: - Byte.MIN_VALUE);
15: if (hexStr.length() == 1)
16: buf.append('0');
17: buf.append(hexStr);
18: }
19: buf.append("]");
20: return buf.toString();
21: }
22: }
|