 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
Create BigInteger via long type variable in Java
BigInteger class is used for big integer calculations which are outside the limit of the primitive data types. It provides operations for modular arithmetic, GCD calculation, primality testing, prime generation, bit manipulation, and a few other miscellaneous operations.
Firstly, set a long value −
Long l = 198L;
Now, create a new object for BigInteger and pass the above value −
BigInteger bInteger = new BigInteger(l);
The following is an example −
Example
import java.math.BigInteger; public class Demo {    public static void main(String[] argv) throws Exception {       Long l = 198L;       BigInteger bInteger = BigInteger.valueOf(l);       System.out.println(bInteger);    } }  Output
198
Advertisements
 