Shifting a Java BitSet

后端 未结 8 1534
太阳男子
太阳男子 2020-12-31 00:11

I am using a java.util.BitSet to store a dense vector of bits.

I want to implement an operation that shifts the bits right by 1, analogous to >

8条回答
  •  隐瞒了意图╮
    2020-12-31 00:46

    You can look at the BitSet toLongArray and the valueOf(long[]).
    Basically get the long array, shift the longs and construct a new BitSet from the shifted array.

提交回复
热议问题