Java BitSet To Byte Array bitsetToBinary(BitSet set, int n)

Here you can find the source of bitsetToBinary(BitSet set, int n)

Description

bitset To Binary

License

Open Source License

Declaration

public static String bitsetToBinary(BitSet set, int n) 

Method Source Code


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

import java.util.BitSet;

public class Main {
    public static String bitsetToBinary(BitSet set, int n) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++)
            sb.append(set.get(i) ? "1" : "0");
        return sb.toString();
    }/* w  w  w  .  j a v a 2  s  .  c o  m*/
}

Related

  1. bitSetToBinaryString(BitSet b, int startBit, int length)
  2. bitSetToBinaryString(BitSet strainBitSet)
  3. bitSetToByteArray(BitSet bitSet, int bitSetLength)
  4. bitSetToByteArray(BitSet bitSet, int byteLen)