Multiply one BigDecimal to another BigDecimal in Java
Description
The following code shows how to multiply one BigDecimal to another BigDecimal.
Example
/*from w w w .ja va 2s. c o m*/
import java.math.BigDecimal;
public class Main {
public static void main(String[] argv) throws Exception {
BigDecimal bd1 = new BigDecimal("123456789.0123456890");
BigDecimal bd2 = BigDecimal.valueOf(123L);
bd1 = bd1.multiply(bd2);
System.out.println(bd1);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »