List of usage examples for java.util BitSet set
public void set(int bitIndex)
From source file:MainClass.java
public static void main(String[] argv) { BitSet bs = new BitSet(); bs.set(65); System.out.println("Bit 65 is " + bs.get(65)); }
From source file:MainClass.java
public static void main(String args[]) { BitSet bites = new BitSet(); bites.set(0); bites.set(1);/*from w ww . ja va2 s .co m*/ bites.set(2); bites.set(3); System.out.println(bites); }
From source file:MainClass.java
public static void main(String args[]) { BitSet bites = new BitSet(); bites.set(0); bites.set(1);/*from w ww . ja va 2 s . co m*/ bites.set(2); bites.set(3); System.out.println(bites.size()); System.out.println(bites.length()); }
From source file:MainClass.java
public static void main(String args[]) { BitSet bites = new BitSet(); bites.set(0); bites.set(1);//from www. j a v a 2s . c om bites.set(2); bites.set(3); BitSet bitSetClone = (BitSet) bites.clone(); System.out.println(bites); System.out.println(bitSetClone); }
From source file:Main.java
public static void main(String args[]) { BitSet bites = new BitSet(); bites.set(0); bites.set(1);/*from w w w . j a v a2 s .c om*/ bites.set(2); bites.set(3); System.out.println(bites); bites.andNot(bites); System.out.println(bites); }
From source file:NumSeries.java
public static void main(String[] args) { for (int i = 1; i <= months.length; i++) System.out.println("Month # " + i); for (int i = 0; i < months.length; i++) System.out.println("Month " + months[i]); BitSet b = new BitSet(); b.set(0); // January b.set(3); // April for (int i = 0; i < months.length; i++) { if (b.get(i)) System.out.println("Month " + months[i] + " requested"); }// w ww.ja va 2s.c o m }
From source file:Main.java
public static void main(String[] args) { BitSet bitset1 = new BitSet(8); bitset1.set(0); bitset1.set(1);//from ww w .j a va 2 s .c o m bitset1.set(2); BitSet bitset2 = new BitSet(8); bitset1.set(0); bitset1.set(1); bitset1.set(2); System.out.println(bitset1.equals(bitset2)); }
From source file:Main.java
public static void main(String[] args) { BitSet bs = new BitSet(); bs.set(31); bs.set(15);/* w ww . ja v a 2 s .c om*/ bs.set(18); int[] intArray = bits2Ints(bs); for (int i = 0; i < intArray.length; i++) System.out.println(toBinary(intArray[i])); }
From source file:MainClass.java
public static void main(String args[]) { BitSet bites = new BitSet(); bites.set(0); bites.set(1);//from w ww.ja v a2s. co m bites.set(2); bites.set(3); System.out.println(bites); bites.and(bites); System.out.println(bites); bites.or(bites); System.out.println(bites); bites.xor(bites); System.out.println(bites); bites.andNot(bites); System.out.println(bites); }
From source file:BitOps.java
public static void main(String args[]) { BitSet set = new BitSet(); set.set(1); set.set(2);// www. j ava2s. co m set.set(3); set.set(4); set.set(5); System.out.println(set); BitSet set2 = new BitSet(); set2.set(1); set2.set(3); set2.set(5); set2.set(7); BitSet set3 = (BitSet) set.clone(); set3.and(set2); System.out.println(set3); set3 = (BitSet) set.clone(); set3.or(set2); System.out.println(set3); set3 = (BitSet) set.clone(); set3.xor(set2); System.out.println(set3); set3 = (BitSet) set.clone(); set3.andNot(set2); System.out.println(set3); set3.andNot(null); }