import java.text.NumberFormat; public class test { public static void main(String[] args) { double d =12345.00000000225168d; String s=formatDouble(d); System.out.println(s); } private static String formatDouble(double d) { NumberFormat nf = NumberFormat.getInstance(); //设置保留多少位小数 nf.setMaximumFractionDigits(20); // 取消科学计数法 nf.setGroupingUsed(false); //返回结果 return nf.format(d); } }