Java examples for java.util:BitSet
Convert a bitset to a BigInteger.
//package com.java2s; import java.util.*; import java.math.*; public class Main { /**//from ww w. jav a2s. c o m * Convert a bitset to a BigInteger. * * @param bs The bitset. * * @return the corresponding BigInteger. */ public static BigInteger ToBigInteger(BitSet bs) { BigInteger value = BigInteger.ZERO; for (int i = 0; i < bs.length(); i += 1) { if (bs.get(i)) value = value.setBit(i); } return value; } }