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

13
LINES

< > BotCompany Repo | #1015249 // hexToBytes old

JavaX fragment (include)

1  
static byte[] hexToBytes(S s) {
2  
  int n = l(s) / 2;
3  
  byte[] bytes = new byte[n];
4  
  for (int i = 0; i < n; i++) {
5  
    S hex = substring(s, i*2, i*2+2);
6  
    try {
7  
      bytes[i] = (byte) parseHexByte(hex);
8  
    } catch {
9  
      fail("Bad hex byte: " + quote(hex) + " at " + i*2 + "/" + l(s));
10  
    }
11  
  }
12  
  ret bytes;
13  
}

Author comment

Began life as a copy of #1004113

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015249
Snippet name: hexToBytes old
Eternal ID of this version: #1015249/1
Text MD5: a7c4332327b47ed29a48c5ee75bcc538
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-11 02:02:11
Source code size: 326 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 404 / 412
Referenced in: [show references]