Java BigInteger Calculate extractInt(BigInteger bi, int start, int end)

Here you can find the source of extractInt(BigInteger bi, int start, int end)

Description

extract Int

License

Open Source License

Declaration

public static int extractInt(BigInteger bi, int start, int end) 

Method Source Code


//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();
    }
}

Related

  1. encodeURL(BigInteger id)
  2. equal(BigInteger int1, BigInteger int2)
  3. equals(BigInteger[] a, BigInteger[] b)
  4. extractBoolean(BigInteger bi, int index)
  5. extractFloat(BigInteger bi, int start, int end, int decimal)
  6. fill(BigInteger[] array, BigInteger value)
  7. first(BigInteger i, BigInteger j)
  8. firstLtSecond(BigInteger first, BigInteger second)
  9. gcd(BigInteger a, BigInteger b)