Java Double to String conversion without formatting

double, format, java, string

Solution

Use Long:

long id = 654987;
String str = Long.toString(id);

Problem

I have the number 654987. Its an ID in a database. I want to convert it to a string. The regular Double.ToString(value) makes it into scientific form, 6.54987E5. Something I dont want. Other formatting functions Ive found checks the current locale and adds appropriate thousand separators and such. Since its an ID, I cant accept any formatting at all. How to do it? [Edit] To clarify: Im working on a special database that treats all numeric columns as doubles. Double is the only (numeric) type I can retrieve from the database.

Original source

Related problems