Wednesday, June 8, 2011

How to convert exponential value to normal decimal form in jsp/java

Problem to display double/large value in jsp/java? How to convert exponential value to normal decimal form in jsp/java?
Many of the time, when we try to display large decimal value in jsp, it display in the value in exponential form instead of normal.

Example: double value 11588200.0, but jsp display 1.15882E7
To display this value in normal decimal format, we can have small parser method separately or just format  as below
               DecimalFormat fmt = new DecimalFormat(value);
       String finalValue = fmt.format(d);


Now finalValue variable will have  11588200.00 value

No comments:

Post a Comment