This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Formating a number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Formating a number" Watch "Formating a number" New topic
Author

Formating a number

Joey Alencar
Ranch Hand

Joined: Jun 26, 2001
Posts: 43
I have one float variable that when I try to show its content, something like this is showed: 7.5E7. How can I put this number in the normal format (like 75000000.00)?
Thanks very much for any help.
Hardy Chou
Greenhorn

Joined: Jun 27, 2001
Posts: 27
use DecimalFormat class
Yogen Vadnere
Ranch Hand

Joined: Sep 20, 2001
Posts: 58
u can try this ,
formatDouble = 7500000000000.00 ;
NumberFormat converter = NumberFormat.getInstance() ;
converter.setMaximumFractionDigits(2);
converter.setMinimumFractionDigits(2);
System.out.println(converter.format(formatDouble))


Yogen Vadnere
Joey Alencar
Ranch Hand

Joined: Jun 26, 2001
Posts: 43
Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formating a number
 
Similar Threads
Hijackers Anonymous
a simple float calculation question
Math.random
Frank did it!
Totally Meaningless