public static BitSet valueOf(LongBuffer lb) {
        lb = lb.slice();
        int n;
        for (n = lb.remaining(); n > 0 && lb.get(n - 1) == 0; n--)
            ;
        long[] words = new long[n];
        lb.get(words);
        return new BitSet(words);
    }
public static BitSet valueOf ( LongBuffer lb ) { lb = lb . slice ( ) ; int n ; for ( n = lb . remaining ( ) ; n > 0 && lb . get ( n - 1 ) == 0 ; n -- ) ; long [ ] words = new long [ n ] ; lb . get ( words ) ; return new BitSet ( words ) ; }
Returns a new bit set containing all the bits in the given long
buffer between its position and limit.

<p>More precisely,
<br>{@code BitSet.valueOf(lb).get(n) == ((lb.get(lb.position()+n/64) & (1L<<(n%64))) != 0)}
<br>for all {@code n < 64 * lb.remaining()}.

<p>The long buffer is not modified by this method, and no
reference to the buffer is retained by the bit set.

@param lb a long buffer containing a little-endian representation
of a sequence of bits between its position and limit, to be
used as the initial bits of the new bit set
@return a {@code BitSet} containing all the bits in the buffer in the
specified range
@since 1.7