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)

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

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: 272 / 293
Version history: 2 change(s)
Referenced in: [show references]