Java BigInteger.shiftLeft(int n)
Syntax
BigInteger.shiftLeft(int n) has the following syntax.
public BigInteger shiftLeft(int n)
Example
In the following code shows how to use BigInteger.shiftLeft(int n) method.
/*w w w . j a v a 2s . c om*/
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
BigInteger bi1 = new BigInteger("10");
// perform leftshift operation on bi1 using 2 and -2
BigInteger bi2 = bi1.shiftLeft(2);
BigInteger bi3 = bi1.shiftLeft(-2);
System.out.println(bi2);
System.out.println(bi3);
}
}
The code above generates the following result.