Here you can find the source of decodeBitListFromBigInteger(BigInteger bits)
public static int[] decodeBitListFromBigInteger(BigInteger bits)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.util.ArrayList; import java.util.List; public class Main { public static int[] decodeBitListFromBigInteger(BigInteger bits) { List<Integer> resultList = new ArrayList<Integer>(); BigInteger mask = BigInteger.ONE; int valueCandidate = 1; while (mask.compareTo(bits) <= 0) { if ((mask.and(bits)).equals(mask)) { resultList.add(Integer.valueOf(valueCandidate)); }//www . ja va2 s.co m valueCandidate++; mask = mask.shiftLeft(1); } int[] result = new int[resultList.size()]; for (int i = 0; i < result.length; i++) { result[i] = resultList.get(i).intValue(); } return result; } }