BitOps : BitSet : Collections Data Structure : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Collections Data Structure   » [  BitSet  ]  Screenshots 
 



BitOps


import java.util.BitSet;

public class BitOps {
  public static void main(String args[]) {
    BitSet set = new BitSet();
    set.set(1);
    set.set(2);
    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 = (BitSetset.clone();
    set3.and(set2);
    System.out.println(set3);
    set3 = (BitSetset.clone();
    set3.or(set2);
    System.out.println(set3);
    set3 = (BitSetset.clone();
    set3.xor(set2);
    System.out.println(set3);
    set3 = (BitSetset.clone();
    set3.andNot(set2);
    System.out.println(set3);
    set3.andNot(null);
  }
}


           
       
Related examples in the same category
1.  Java 1.5 (5.0) Changes to the API: several of the new bit manipulation methods in Integer. Java 1.5 (5.0) Changes to the API: several of the new bit manipulation methods in Integer.
2.  The use of BitSet The use of BitSet
3.  Manipulating the BitSet Manipulating the BitSet
4.  Another Bitset demo Another Bitset demo
5.  Operations on series of numbers
6.  BitOHoney
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.