BigInteger.shiftRight(int n) has the following syntax.
public BigInteger shiftRight(int n)
In the following code shows how to use BigInteger.shiftRight(int n) method.
//from www.j a v a 2 s .com import java.math.BigInteger; public class Main { public static void main(String[] args) { BigInteger bi1 = new BigInteger("4"); // perform right shift operation on bi1 using 2 and -2 BigInteger bi2 = bi1.shiftRight(2); BigInteger bi3 = bi1.shiftRight(-2); System.out.println(bi2); System.out.println(bi3); } }
The code above generates the following result.