Here you can find the source of toInt(int length, BigInteger bi)
public static int[] toInt(int length, BigInteger bi)
//package com.java2s; //License from project: Open Source License import java.math.BigInteger; public class Main { public static int[] toInt(int length, BigInteger bi) { byte[] ba = bi.toByteArray(); int[] ia = new int[length]; for (int j = ba.length - 1; j >= 0; j--) { int changeByte = ((ba.length - 1 - j) % 4); int jj = length - 1 - (ba.length - 1 - j) / 4; ia[jj] |= (ba[j] & 0xff) << (changeByte * 8); }//ww w. ja v a 2s . com return ia; } }