print BitSet - Java java.util

Java examples for java.util:BitSet

Description

print BitSet

Demo Code


//package com.java2s;
import java.util.BitSet;

public class Main {
    public static void printBitSet(BitSet bits) {
        boolean bit;
        for (int i = 0; i < bits.length(); i++) {
            bit = bits.get(i);/* w  w w. j  a v  a2s .c o m*/
            if (bit)
                System.out.print(1);
            else
                System.out.print(0);
        }
        System.out.println();
    }
}

Related Tutorials