Here you can find the source of toInteger(final BitSet bits)
public static int toInteger(final BitSet bits)
//package com.java2s; import java.util.BitSet; public class Main { public static int toInteger(final BitSet bits) { int value = 0; for (int i = 0; i < 32; ++i) { value += bits.get(i) ? (1 << i) : 0; }// w w w.j a va2 s . c o m return value; } }