Here you can find the source of bitsetToBinary(BitSet set, int n)
public static String bitsetToBinary(BitSet set, int n)
//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*/ }