Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Float value  RSS feed

 
Mahesh Mamani
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Report post to moderator
Pretty please don't post the same question in multiple categories. Look in the Beginner's Forum for at least one idea so far.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!