1 | // n = length in bits |
2 | static byte[] bitSetToBytes(BitSet bs, int n) { |
3 | byte[] bytes = new byte[(n+7)/8]; |
4 | for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) |
5 | bytes[i/8] |= 1 << (i%8); |
6 | return bytes; |
7 | } |
Began life as a copy of #1006138
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1006139 |
Snippet name: | bitSetToBytes |
Eternal ID of this version: | #1006139/1 |
Text MD5: | 724eecab459651980ffc4bb4fb0a6704 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-21 13:33:58 |
Source code size: | 224 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 508 / 520 |
Referenced in: | [show references] |