import java.util.BitSet;
import hlt.language.util.IntIterator;
import hlt.osf.util.BitCode;

public class BitCodeIteratorTest
{
  final public static void main (String args[])
  {
    BitCode code = new BitCode();

    code.set(4);
    code.set(5);
    code.set(8);

    System.out.println("Bit code size: "+code.length());

    System.out.println("Bit code: "+code.toBitString(code.length()));

    System.out.print("Iterating through 1-bits: ");
    for (IntIterator it = code.iterator(); it.hasNext();)
      System.out.print(it.next()+" ");
    System.out.println();

    System.out.print("Iterating through 0-bits from pos. 0 (incl.) up to "+code.length()+" (excl.): ");
    for (IntIterator it = code.zeroIterator(); it.hasNext();)
      System.out.print(it.next()+" ");
    System.out.println();

    int limit = 11;

    System.out.print("Iterating through 0-bits from pos. 0 (incl.) up to "+limit+" (excl.): ");
    for (IntIterator it = code.zeroIterator(limit); it.hasNext();)
      System.out.print(it.next()+" ");
    System.out.println();

  }
}