`
El_Nino
  • 浏览: 201021 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

在JAVA中怎么进行格式输出

 
阅读更多

要先引个包

import java.text.DecimalFormat;

public class a {

double x=0.123456;

public float out{

DecimalFormat fmt = new DecimalFormat("0.##");
String str=fmt.format(x);
x=Double.parseDouble(str);

return x;

}

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics