0

I want to convert KB to MB but when the file size is very small, converting result is exponential that as follows:

very small file size:17.48 kb convert to 1.748E-5

and converter code in java is as follows:

List<Double> file_size = (List<Double>) doc.getFieldValue("file_size");
..
..
//According to google converting formula
file_size.set(0, file_size.get(0)*Math.pow(10.0, -6.0));

and finally, i want to convert result(exponential) to double

Thank you in advance for your help.

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
  • possible duplicate of [How to print double value without scientific notation using Java?](http://stackoverflow.com/questions/16098046/how-to-print-double-value-without-scientific-notation-using-java) – khelwood Jul 09 '15 at 12:28

2 Answers2

1

Simply use:

double m = size/1024D
Rajesh
  • 2,135
  • 1
  • 12
  • 14
0

you should use printf instead of println

gurghet
  • 7,591
  • 4
  • 36
  • 63