public static void main(String[] args) {
int a=100000;
int b=1000;
double c = (double) a/(double) b;
DecimalFormat df3 = new DecimalFormat("0.0000");
// DecimalFormat df2 = new DecimalFormat("###.00");
//DecimalFormat df3 = new DecimalFormat("##.000");
System.out.print(df3.format(c));//
}
JAVA中保留N位小数的方法,
最新推荐文章于 2023-10-31 21:09:37 发布