J2ME - How to convert double to string without the power to 10 representation (E-05)

后端 未结 4 1429
故里飘歌
故里飘歌 2021-01-18 08:15

I have a double value . I want to store it in String with out E notation (in J2ME)

Example

Double value 6.887578324E9 Want to show as 6887578342

4条回答
  •  迷失自我
    2021-01-18 08:54

    You can use Java Formatter, just specify how many decimals do you want with the string.

    E.g. a double converted to a number with one decimal:

    Formatter format = new Formatter();
    String mystring = format.formatNumber(DOUBLENUMBERVARIABLE,1);
    System.out.println(mystring );
    

提交回复
热议问题