/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
{ 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)) { } 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(); }