Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Parse decimal string to create BigInteger in Java
To parse the decimal string to create BigInteger, just set the decimal string in the BigInteger.
Here is our BigInteger.
BigInteger one; String decStr = "687879"; one = new BigInteger(decStr);
Let us see another example −
Example
import java.math.*;
public class Demo {
public static void main(String[] args) {
BigInteger one, two;
String decStr = "4373427";
one = new BigInteger("250");
two = new BigInteger(decStr);
System.out.println("Result (BigInteger) : " +one);
System.out.println("Result (Parsing Decimal String) : " +two);
}
}
Output
Result (BigInteger) : 250 Result (Parsing Decimal String) : 4373427
Advertisements
