
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Shift Left in a BigInteger in Java
To shift left in a BigInteger, use the shiftLeft() method.
The java.math.BigInteger.shiftLeft(int n) returns a BigInteger whose value is (this << n). The shift distance, n, may be negative, in which case this method performs a right shift. It computes floor(this * 2n).
Example
import java.math.*; public class Demo { public static void main(String[] args) { BigInteger one; one = new BigInteger("25"); one = one.shiftLeft(3); System.out.println("Result: " +one); } }
Output
Result: 200
Advertisements