Java BitSet.valueOf(ByteBuffer bb)

Syntax

BitSet.valueOf(ByteBuffer bb) has the following syntax.

public static BitSet valueOf(ByteBuffer bb)

Example

In the following code shows how to use BitSet.valueOf(ByteBuffer bb) method.


//from www.ja  v  a2  s  . c o m
import java.nio.ByteBuffer;
import java.util.BitSet;

public class Main {

   public static void main(String[] args) {

      ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[]{1,2,3});
      BitSet bitset1 = BitSet.valueOf(byteBuffer);

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

   }
}

The code above generates the following result.