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

后端 未结 4 1431
故里飘歌
故里飘歌 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:56

    Have a look at this article: Converting Double to String without E notation

    You can make use of the [NumberFormat][2] or [DecimalFormat][3] class to acheive what you are looking for.

    Here is the code:

    NumberFormat f = NumberFormat.getInstance();
    f.setGroupingUsed(false);
    String refinedNumber = f.format(doubleVariable);
    

提交回复
热议问题