I have a user string generated by some computations. The user string is "3.2E7" It is written in Scientific Notation. I need to convert it to standard notation because the drawing instructions on the App overlap if it reads a Scientific Notation number.
I do know how to convert it to Standard Notation use the Number class, as the following shows:
String generated = "3.2E7"
try{
NumberFormat format = NumberFormat.getInstance();
Number my_number = format.parse(generated);
System.out.println("see my number: " + my_number); //this prints correctly: 32000000
}catch(Exception exception){
Log.d("see009",""+exception);
}
Now, the problem I am having is that if the variable 'generated' < 1 but greater than zero. Then, the NumberFormat class does not convert it properly:
String generated = "3.2E-7";
//inside the try catch block from above:
System.out.println("see my number: " + my_number); //this prints 3.2E-7 NOT: 0.00000032
Doesn't the Number class accept non-integers. How can I make the NumberFormat object format the Scientific notation number less than 1?