List of usage examples for java.util BitSet set
public void set(int bitIndex)
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);// w w w . ja v a 2 s. c o m bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1.previousClearBit(1)); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/*from ww w. ja v a 2 s . co m*/ bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1.previousSetBit(1)); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/* w ww . j a v a 2 s . com*/ bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println(Arrays.toString(bitset1.toLongArray())); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);//from w w w . j av a 2 s . c o m bitset1.set(2); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println(Arrays.toString(bitset1.toByteArray())); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/* ww w . j ava 2s .com*/ bitset1.set(2); System.out.println(bitset1); bitset1.flip(1); System.out.println(bitset1); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(); BitSet bitset2 = new BitSet(); // assign values to bitset1 bitset1.set(0); bitset1.set(1);//ww w .ja va 2s.c o m bitset1.set(2); // assign values to bitset2 bitset2.set(2); bitset2.set(4); bitset2.set(6); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println("Bitset2:" + bitset2); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); BitSet bitset2 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/* w w w . j a va 2 s. co m*/ bitset1.set(2); // assign values to bitset2 bitset2.set(2); bitset2.set(4); bitset2.set(6); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println("Bitset2:" + bitset2); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); BitSet bitset2 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/* w w w. ja v a2 s.c o m*/ bitset1.set(2); // assign values to bitset2 bitset2.set(2); bitset2.set(4); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println("Bitset2:" + bitset2); System.out.println(bitset1.get(1)); System.out.println(bitset2.get(2)); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); BitSet bitset2 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);/*from ww w.ja v a 2 s . c om*/ bitset1.set(2); // assign values to bitset2 bitset2.set(2); bitset2.set(4); bitset2.set(6); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println("Bitset2:" + bitset2); // check if bitset1 intersects with bitset2 System.out.println(bitset1.intersects(bitset2)); }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); BitSet bitset2 = new BitSet(8); // assign values to bitset1 bitset1.set(0); bitset1.set(1);//from w w w .j a va 2 s . c o m bitset1.set(2); // assign values to bitset2 bitset2.set(2); bitset2.set(4); // print the sets System.out.println("Bitset1:" + bitset1); System.out.println("Bitset2:" + bitset2); // print the size of the bitsets System.out.println(bitset1.size()); System.out.println(bitset2.size()); }