Create Big Decimal Values from a string in Java
Description
The following code shows how to create Big Decimal Values from a string.
Example
// w w w.ja v a 2 s . c o m
import java.math.BigDecimal;
public class Main {
public static void main(String[] argv) throws Exception {
// Create via a string
BigDecimal bd1 = new BigDecimal("123456789.0123456890");
System.out.println(bd1);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »