Avoiding exponential notation while outputting doubles to file

Hi all,

I am writing doubles to a file. For very small or large numbers the output is in "E notation format"

For example

double d = 0.0009

filePrintStream.println(d);

This puts 9.0E-4 in the output file. How can I just make it enter 0.0009 and not 9.0E-4 ?

Many thanks,

Greg.

[324 byte] By [GregShuklaa] at [2007-11-27 11:52:27]
# 1

have you looked at the numberFormat class? or decimalFormat?

petes1234a at 2007-7-29 18:44:35 > top of Java-index,Java Essentials,Java Programming...
# 2

You can find the API here:

http://java.sun.com/javase/6/docs/api/

You can find tons of examples by searching the forum. eg:

http://forum.java.sun.com/thread.jspa?forumID=54&threadID=782437

http://forum.java.sun.com/thread.jspa?forumID=513&threadID=450443

petes1234a at 2007-7-29 18:44:35 > top of Java-index,Java Essentials,Java Programming...