fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. java.text.DecimalFormat df = new java.text.DecimalFormat("#,###.######################################################");
  9.  
  10. String value = "-3.04567E-8";
  11. String[] tabOfFloatString = value.split(" ");
  12. int length = tabOfFloatString.length;
  13. System.out.println("Length of float string is" + length);
  14. float[] floatsArray = new float[length];
  15. for (int l=0; l<length; l++) {
  16. float res = Float.parseFloat(tabOfFloatString[l]);
  17. System.out.println("Float is " + res);
  18.  
  19. System.out.println(df.format(res));
  20.  
  21. floatsArray[l]=res;
  22. }
  23. }
  24. }
Success #stdin #stdout 0.05s 246144KB
stdin
Standard input is empty
stdout
Length of float string is1
Float is -3.04567E-8
-0.000000030456700272907256