Java Collection Tutorial - Java BitSet.valueOf(LongBuffer lb)


BitSet.valueOf(LongBuffer lb) has the following syntax.

public static BitSet valueOf(LongBuffer lb)


In the following code shows how to use BitSet.valueOf(LongBuffer lb) method.

import java.nio.LongBuffer;
import java.util.BitSet;
/*w  w  w . j ava2  s  . co m*/
public class Main {

   public static void main(String[] args) {

      LongBuffer byteBuffer = LongBuffer.wrap(new long[]{1L,2L,3L});
      BitSet bitset1 = BitSet.valueOf(byteBuffer);

      // print the sets
      System.out.println("Bitset1:" + bitset1);


The code above generates the following result.