Here you can find the source of extractInt(BigInteger bi, int start, int end)
public static int extractInt(BigInteger bi, int start, int end)
//package com.java2s; import java.math.BigInteger; public class Main { public static int extractInt(BigInteger bi, int start, int end) { bi = bi.shiftRight(start);//from ww w. j av a 2 s . c om int foo = (int) Math.pow(2, end - start) - 1; BigInteger mask = BigInteger.valueOf(foo); bi = bi.and(mask); return bi.intValue(); } }