Here you can find the source of convertIntToBitSet(int value)
public static BitSet convertIntToBitSet(int value)
//package com.java2s; //License from project: Apache License import java.util.BitSet; public class Main { public static BitSet convertIntToBitSet(int value) { BitSet bits = new BitSet(); int index = 0; while (value != 0) { if ((value % 2) != 0) { bits.set(index);//from w w w .ja va2s . c o m } ++index; value = value >>> 1; } return bits; } }