Revision: 43039
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 15, 2011 19:20 by vss
Initial Code
public String bytesToHexString(byte[] b) { final char [] chars = new char[] {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F'}; if ((b == null) || (b.length == 0)) { throw new IllegalArgumentException("argument null or zero length"); } StringBuffer buff = new StringBuffer(b.length * 2); for (int i = 0; i < b.length; i++ ) { buff.insert(i*2,chars[(b[i] >> 4) & 0xf]); buff.insert(i*2+1,chars[b[i] & 0xf]); } return buff.toString(); }
Initial URL
Initial Description
Initial Title
Bytes to hex string
Initial Tags
convert
Initial Language
Java