This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Who can handle the problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Who can handle the problem?" Watch "Who can handle the problem?" New topic
Author

Who can handle the problem?

Steven Gao
Greenhorn

Joined: Nov 28, 2002
Posts: 4
Code as follows:
public class testing{
public static void main(String argv[]){
double ii=123456789.12345;
System.out.println("ii="+ii);
}
}
The output is: ii=1.2345678912345E8
But I want to get: ii=123456789.12345
How can I do it? Is it any function to solve it?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
By default, numbers are formatted in scientific notation. The class java.text.DecimalFormat will help you do what you expect.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Steven Gao
Greenhorn

Joined: Nov 28, 2002
Posts: 4
Thank you for your help.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Who can handle the problem?
 
Similar Threads
Passing Params thru wait/notify
continue blues
2D Arrays
generating a Product Activation Code
user defined data type