Java BigInteger shiftLeft() MethodThe shiftLeft() method of Java BigInteger class is used to shift the bits to the left by n times (shift distance). This method returns a BigInteger whose value is (this<<n). This method Computes floor (this * 2n). Syntax:Parameter:n- shift distance, in bits Returns:This method returns (this<< n). Exception:NA Note: The shift distance n, may be negative, in which case this method performs a right shift.Example 1Test it NowOutput: Shift left operation on 5, 2 times gives 20 Example 2Test it NowOutput: Shift left operation on 5, -2 times gives 1 Example 3Test it NowOutput: Shift left operation on 1, 4 times gives 16 Next TopicJava BigInteger |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India