Skip to main content

Converting a double to String

2 replies [Last post]
inoxidotos
Offline
Joined: 2009-05-20
Points: 0

Hi all,

I want to convert a double with a big value (let's say: 99999999) to a String.

My problem is that if the value is that big, the double value is converted to a string where the double value is displayed with scientific notation.

Does anyone know how can I avoid the scientific notation ?
I want "99999999" and not "9.9999999E7".

How can I do this ?
Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
raggi
Offline
Joined: 2009-09-20
Points: 0

Hi,

System.out.printf("%.0f", x);

more info about formatters you can find here: http://sharkysoft.com/archive/printf/docs/javadocs/lava/clib/stdio/doc-f...

Best wishes,
Andrew

jaywayjohan
Offline
Joined: 2008-06-18
Points: 0

Hi,

is this library also working on Java ME with CLDC?

Regards
Johan