Format BigDecimal without scientific notation with full precision

前端 未结 4 670
感动是毒
感动是毒 2021-02-06 22:26

I\'d like to convert a BigDecimal to String for printing purposes but print out all digits without scientific notation. For example:

Bi         


        
4条回答
  •  天涯浪人
    2021-02-06 23:19

    You could use this

    BigDecimal d = BigDecimal.valueOf(12334535345456700.12345634534534578901);
    String out= d.toPlainString();
    System.out.println(out);
    

提交回复
热议问题