Java BitSet.valueOf(byte[] bytes)

Syntax

BitSet.valueOf(byte[] bytes) has the following syntax.

public static BitSet valueOf(byte[] bytes)

Example

In the following code shows how to use BitSet.valueOf(byte[] bytes) method.


import java.util.BitSet;
//  w w w . j a v  a2s.c  om
public class Main {

   public static void main(String[] args) {

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

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

   }
}

The code above generates the following result.