数字格式化,double小数不用科学计数法--备忘

luozhangwen 2010-08-25 05:50:13


public static void main(String[] args) throws Exception
{
doubleToString();
double aa = 3100000000.125;
System.out.println(doubleToString(aa));
}

public static String doubleToString(Object value)
{
DecimalFormat df = new DecimalFormat("#,###");
String strValue = df.format(value);
return strValue;
}
public static void doubleToString()
{
double jellen = (1.0/70000000);
System.out.println(jellen);

NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMaximumFractionDigits(30); //设置最大小数位
String s = formatter.format(jellen);
System.out.println(s);
}
...全文
814 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
vodown 2012-07-23
  • 打赏
  • 举报
回复
有用,备忘

23,405

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧