A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Joined: Aug 21, 2003
Feb 28, 2005 10:47:00
Hi there. This is a really quick one. If I have a float value 3.5711762E-6,
how do I just return the number to four decimal places, i.e. 3.5718. Cheers, Joe
Joined: Dec 29, 2004
Feb 28, 2005 10:51:00
Probably have to convert it to a
and then use subString to get the right number of digits. If you were to use
I think it has methods that do that for you.
Joined: Dec 06, 2001
Feb 28, 2005 11:00:00
It depends on how you want to use the rounded version. If you are simply displaying the value, then you should use the
class. If you need to round a number for calculations, you should look at the round() method in the
[ February 28, 2005: Message edited by: Layne Lund ]
Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: Quick question
Hashtable doent allow null values ???
Why does 8 equal 8.5?
Getting a handle on the SCJD
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014