Here you can find the source of bigIntegerToBitArray(BigInteger x, int length)
public static int[] bigIntegerToBitArray(BigInteger x, int length) throws Exception
//package com.java2s; import java.math.*; public class Main { public static int[] bigIntegerToBitArray(BigInteger x, int length) throws Exception { int[] result = new int[length]; for (int i = 0; i < result.length; i++) { result[i] = x.testBit(i) ? 1 : 0; }/*w w w. ja va 2 s . com*/ return result; } }