convert scientific value into simple format
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Divyakant_Verma
Posted On:   Wednesday, June 9, 2004 09:54 PM

hi
i am working in java (jsp) platform & getting problom to display large double value like 987654321.12 in its original format , it prints in scientific value, like 9.87654321E8
so can anybody have idea to convert scientific value into simple format.

Divyakant Verma

Re: convert scientific value into simple format in java/jsp

Posted By:   Divyakant_Verma  
Posted On:   Thursday, June 10, 2004 12:15 AM

hi
u can use java.text.DecimalFormat class to solve this problem. try this


import java.text.DecimalFormat;



public class FormatTest {

public static void main(String[] args) {

DecimalFormat myformat = new DecimalFormat("0.00");



for (long i=1; i<=1000000; i=i*10) {

System.out.println(myformat.format(123456789.12*i));


}

}

}




regards

Divyakant Verma
About | Sitemap | Contact