Java BigDecimal.toString()
Syntax
BigDecimal.toString() has the following syntax.
public String toString()
Example
In the following code shows how to use BigDecimal.toString() method.
import java.math.BigDecimal;
import java.math.MathContext;
/*from w ww .j av a 2 s . co m*/
public class Main {
public static void main(String[] args) {
MathContext mc = new MathContext(3); // 3 precision
BigDecimal bg = new BigDecimal("1234E4", mc);
System.out.println(bg.toString());
}
}
The code above generates the following result.