Java examples for java.util:BitSet
Convert a BitSet to a string representation in the specified radix.
//package com.java2s; import java.util.*; import java.math.*; public class Main { /**/*from www . jav a2 s. c om*/ * Convert a BitSet to a string representation in the specified radix. * * @param bs The BitSet to convert. * @param radix The radix to convert the BitSet to. * * @return A string representation of the BitSet in the specified radix. */ public static String ToString(BitSet bs, int radix) { BigInteger bi = BigInteger.ZERO; for (int index = bs.nextSetBit(0); index >= 0; index = bs .nextSetBit(index + 1)) { bi = bi.setBit(index); } return bi.toString(radix).toUpperCase(); } }