fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.text.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. DecimalFormat df = new DecimalFormat("#.##########");
  10.  
  11. float fileLengthMegabytes1 = (float) 388 / 1000000;
  12. float fileLengthMegabytes2 = (float) 388 / 1048576;
  13. System.out.println("MB1 in Scientific Notation: " + fileLengthMegabytes1);
  14. System.out.println("MB1 in Decimal Notation: " + df.format(fileLengthMegabytes1));
  15. System.out.println("MB2 in Scientific Notation: " + fileLengthMegabytes2);
  16. System.out.println("MB2 in Decimal Notation: " + df.format(fileLengthMegabytes2));
  17. }
  18. }
Success #stdin #stdout 0.05s 246144KB
stdin
Standard input is empty
stdout
MB1 in Scientific Notation: 3.88E-4
MB1 in Decimal Notation: 0.000388
MB2 in Scientific Notation: 3.7002563E-4
MB2 in Decimal Notation: 0.0003700256