Your preferences have been saved!
» Operations on bit-mapped fields. - */ public class BitField {          private final int _mask;     private final int _shift_count;     /**      * <p>Creates a BitField instance.</p>      *      * @param mask the mask specifying which bits apply to this      *  BitField. Bits that are set in this mask are the bits... 18 Feb 12 » Implementation of a bit map of any size, together with - */ public class BitMap {     int   defaultCapacity;     int   capacity;     int[] map;     int   limitPos;     public BitMap(int initialCapacity) {         int words = initialCapacity / 32;         if (initialCapacity % 32 != 0) {             words++;... 18 Feb 12 » Convert bitset to int array and string - import java.util.BitSet; public class Main {   public static void main(String[] args) {     BitSet bs = new BitSet();     bs.set(31);     bs.set(15);     bs.set(18);     int[] intArray = bits2Ints(bs);     for (int i = 0; i < intArray.length; i++)       System.out.println(toBinary(intArray[i]));... 18 Feb 12 » 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);... 18 Feb 12 » BitOHoney - import java.util.BitSet; public class BitOHoney1 {   public static void main(String args[]) {     String names[] = { "Hershey's Kisses", "Nestle's Crunch", "Snickers",         "3 Musketeers", "Milky Way", "Twix", "Mr. Goodbar", "Crunchie",         "Godiva", "Charleston Chew", "Cadbury's", "Lindt", "Aero",         "Hebert", "Toberlone", "Smarties", "LifeSavers", "Riesen",         "Goobers", "Raisenettes", "Nerds", "Tootsie Roll",         "Sweet Tarts", "Cotton Candy" };     BitSet bits = new BitSet();... 18 Feb 12 » Operations on series of numbers - import java.util.BitSet; public class NumSeries {   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... 18 Feb 12 » Another Bitset demo - */ public class A extends Object {   public class B {  // member class     public class BB {       public void print() {         System.out.println("Hello from BB");       }     }     public void print() {       BB bb = new BB();... 18 Feb 12 » Manipulating the BitSet - import java.util.BitSet; public class TwoBitPlanets {   public static void main(String args[]) {     String names[] = { "Mercury", "Venus", "Earth", "Mars", "Jupiter",         "Saturn", "Uranus", "Neptune", "Pluto" };     int moons[] = { 0, 0, 1, 2, 16, 18, 17, 8, 1 };     int namesLen = names.length;     BitSet bits = new BitSet(namesLen);     for (int i = 0; i < namesLen; i++) {       if ((moons[i] % 2) == 0) {... 18 Feb 12 » The use of BitSet - import java.util.BitSet; public class BitOHoney {   public static void main(String args[]) {     String names[] = { "Java", "Source", "and",         "Support"};     BitSet bits = new BitSet();     for (int i = 0, n = names.length; i < n; i++) {       if ((names[i].length() % 2) == 0) {         bits.set(i);       }... 18 Feb 12 » Java 1.5 (5.0) Changes to the API: several of the - public class Bits {    public static void main(String args[]) {      int n = 170; // 10101010      System.out.println("Value in binary: 10101010");        System.out.println("Number of one bits: " + Integer.bitCount(n));        System.out.println("Highest one bit: " + Integer.highestOneBit(n));        System.out.println("Lowest one bit: " + Integer.lowestOneBit(n)); ... 18 Feb 12