wood burning stoves 2.0*
The moose likes Java in General and the fly likes Float value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

Float value

Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Hi All,
I want to get float value of a string, but for small values I get it in the form "6.0E-4". Can any1 help me in getting 0.0006 in Float value???
public class flt1{
public static void main(String kk[]){
String val = "0.0006";
Float resultflt = new Float(val);
System.out.println("Flt val is "+resultflt.floatValue());
}
}
Thanks in advance.
Mahesh
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Pretty please don't post the same question in multiple categories. Look in the Beginner's Forum for at least one idea so far.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Float value
 
Similar Threads
Float
Packed decimal conversion - Java
throws NumberFormatException ???
string to float conversion round off problem
testing for integer