BitSet to String - Java java.util

Java examples for java.util:BitSet

Description

BitSet to String

Demo Code


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

public class Main {
    public static String toString(BitSet bs) {
        int len = bs.length();
        StringBuffer buf = new StringBuffer(len);
        for (int i = 0; i < len; i++)
            buf.append(bs.get(i) ? '1' : '0');
        return buf.toString();
    }/*from   w ww  .  j  av a2s. c  om*/
}

Related Tutorials