0

I am converting double number into string but i am not getting as it is. following is my code and result:

double d = 123456789123.0;
String test = String.valueOf(d);
System.out.println("InString"+test);

Result:

InString :1.23456789123E11

expected result: 123456789123.0

Sarz
  • 1,970
  • 4
  • 23
  • 43

2 Answers2

0

Consider NumberFormat class from standard java library.

Use it's methods to format a double value.

0

Try this:

    NumberFormat nf = new DecimalFormat("000000000000.0");
    String test = nf.format(d);
Jens
  • 67,715
  • 15
  • 98
  • 113