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

7
LINES

< > BotCompany Repo | #1020587 // bitSetToByteList - list contains indices of set bits

JavaX fragment (include)

1  
static L<Byte> bitSetToByteList(BitSet bs) {
2  
  if (bs == null) null;
3  
  L<Byte> l = emptyList(bitCount(bs));
4  
  for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1))
5  
    l.add((byte) i);
6  
  ret l;
7  
}

Author comment

Began life as a copy of #1020586

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020587
Snippet name: bitSetToByteList - list contains indices of set bits
Eternal ID of this version: #1020587/3
Text MD5: 7302beb1a5d27b0498d6130deb49803d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-27 17:37:18
Source code size: 210 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 296
Version history: 2 change(s)
Referenced in: [show references]