JAVA: dump byte array as hex string
labai ieškojau...
public static String dumpBytes(byte[] bs) {
StringBuffer ret = new StringBuffer(bs.length);
for (int i = 0; i < bs.length; i++) {
String hex = Integer.toHexString(0x0100 + (bs[i] & 0x00FF)).substring(1);
ret.append((hex.length() < 2 ? "0" : "") + hex);
}
return ret.toString();
}
Comments
GeeK
enc @ 2004-09-26 12:46:56
different language, same code. Thanks
anonymous @ 2006-08-14 23:55:02