Here you can find the source of bigIntToArray(BigInteger data)
public static int[] bigIntToArray(BigInteger data)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; import java.util.ArrayList; import java.util.List; public class Main { public static int[] bigIntToArray(BigInteger data) { List<Integer> dataList = new ArrayList<Integer>(); for (int i = 0; data.bitCount() > 0; i++, data = data.shiftRight(1)) { if (data.testBit(0)) dataList.add(i);//w ww .j ava2 s . c om } int[] dataArr = new int[dataList.size()]; for (int i = 0; i < dataArr.length; i++) dataArr[i] = dataList.get(i); return dataArr; } }