Java BitSet to String bitSet2String(final BitSet bs)

Here you can find the source of bitSet2String(final BitSet bs)

Description

bit Set String

License

Open Source License

Declaration

public static String bitSet2String(final BitSet bs) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.BitSet;

public class Main {
    public static String bitSet2String(final BitSet bs) {
        final StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bs.length(); ++i) {
            final char ch = bs.get(bs.length() - i) ? '1' : '0';
            sb.append(ch);/*from  w w  w .  j ava  2 s. c o  m*/
        }
        return sb.toString();
    }
}

Related

  1. bitSet2String(BitSet b)
  2. bitSetToString(BitSet bits, int length)
  3. bitsetToString(BitSet bitset, int width, int height)
  4. bitsetToString(BitSet bs)