0

I want to format a double so, that there's no scientific notation (the E letter) showing when I have a number larger than a million or so.

I have already formatted the double to have only two decimals.

as in

DecimalFormat dFormat = new DecimalFormat("0.00");

but even with that, I'm seeing 10007999.00 as 1.001511661E7 on the screen. I don't want to see it in that form (can't really think of why anyone would...)

How to format the double so, that it is showing as a normal number, not some letters in it. Thank you.

Steve Waters
  • 3,348
  • 9
  • 54
  • 94
  • 1
    Doesn't replicate for me. – Mena Nov 29 '16 at 16:43
  • 2
    http://stackoverflow.com/questions/16098046/how-to-print-double-value-without-scientific-notation-using-java – Aimee Borda Nov 29 '16 at 16:44
  • This `DecimalFormat` should never format as scientific notation. Please post code to reproduce. My suspicion is that you are doing something like formatting then parsing to "change the format of `double`". – Boris the Spider Nov 29 '16 at 16:44

1 Answers1

3

A 5-minute search on Google brought me here: How to print double value without scientific notation using Java?

This is what you want right?

Here's the same thing, but in a function:

public static String dNoScience(double d) {
    return String.format("%.0f\n", d);
}
Community
  • 1
  • 1