Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
Labels (2)
2 Replies
Anonymous
Not applicable
Author

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
alevy
Specialist

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