Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #2000460 // bytesToHex (standard function)

New Tinybrain snippet

  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();
  }

download  show line numbers   

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: 786 / 5947
Referenced in: #698 - Standard Function Adder (new, developing)
#1002427 - Accellerating 629 (SPIKE)
#1004113 - hexToBytes
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008327 - toHex - synonym of bytesToHex
#2000554 - binaryUrlencode
#3000382 - Answer for ferdie (>> t = 1, f = 0)