How to Convert BigDecimal to String

Hi Members,
We have faced the issue to Convert the BigDecimal to String while execute the Job. can anyone provide the solution?
Regards,
Venkateswarlu.
2 REPLIES
Seventeen Stars

Re: How to Convert BigDecimal to String

hi,
apply toString() to your BigDecimal .
/* example in a tJava*/
BigDecimal bg = new BigDecimal(0.12235645,new java.math.MathContext (8)); //precision 8
System.out.println(bg.toString());

Starting job bigd at 16:00 29/08/2013.
connecting to socket on port 4042
connected
0.12235645
disconnected
Job bigd ended at 16:00 29/08/2013.

see java doc for BG : http://docs.oracle.com/javase/6/docs/api/java/math/BigDecimal.html
that give you 3 different methods to convert BG to String
regards
laurent
Seven Stars

Re: How to Convert BigDecimal to String

For numbers smaller than 0.00001, .toString() gives you exponential notation i.e. 1E-6. Use .toPlainString() instead.