如何使java中double类型不以科学计数法表示

如题所述

//对Double类型的数字进行 格式化输出

Java代码
package com.vincent.test;

import java.text.DecimalFormat;

public class TestDouble_String {
public static void main(String[] args) {

Double double1 = 123456789.123456789;
DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");//格式化设置
System.out.println(decimalFormat.format(double1));
System.out.println(double1);

}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-12-28
System.out.printf("%01.4f\r\n", 123.4567891D); //保留4位小数
相似回答