Java Collection Tutorial - Java BitSet.valueOf(long[] longs)


BitSet.valueOf(long[] longs) has the following syntax.

public static BitSet valueOf(long[] longs)


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

import java.util.BitSet;
/*from  www  .ja v a2 s  .  c  o  m*/
public class Main {

   public static void main(String[] args) {

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

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


The code above generates the following result.