// n = length in bits static byte[] bitSetToBytes(BitSet bs, int n) { byte[] bytes = new byte[(n+7)/8]; for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) bytes[i/8] |= 1 << (i%8); return bytes; }
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: | 709 / 728 |
| Referenced in: | [show references] |