public static String bytesToHex(byte[] bytes) {
    return bytesToHex(bytes, 0, bytes.length);
  }
  public static String bytesToHex(byte[] bytes, int ofs, int len) {
    StringBuilder stringBuilder = new StringBuilder(len*2);
    for (int i = 0; i < len; i++) {
      String s = "0" + Integer.toHexString(bytes[ofs+i]);
      stringBuilder.append(s.substring(s.length()-2, s.length()));
    }
    return stringBuilder.toString();
  }
Snippet is not live.
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #2000460 | 
| Snippet name: | bytesToHex (standard function) | 
| Eternal ID of this version: | #2000460/1 | 
| Text MD5: | 28e24d45a3bae75a71ae7f8f605a2dda | 
| Author: | stefan | 
| Category: | |
| Type: | New Tinybrain snippet | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2015-07-26 18:51:07 | 
| Source code size: | 450 bytes / 12 lines | 
| Pitched / IR pitched: | No / Yes | 
| Views / Downloads: | 1227 / 6076 | 
| Referenced in: | [show references] |