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 >
With java SE8, it can be achieved more concise way:
BitSet b = new BitSet();
b.set(1, 3);
BitSet shifted = BitSet.valueOf(Arrays.stream(
b.toLongArray()).map(v -> v << 1).toArray());
I was trying to figure out how to use LongBuffer to do so but not quite got it to work. Hopefully, someone who is familiar with low level programming can point out a solution.
Thanks in advance!!!