long current = 2;
long all = 9;
NumberFormat nt = NumberFormat.getPercentInstance();
//设置百分数精确度2即保留两位小数
nt.setMinimumFractionDigits(0);
float baifen = (float)current/all;
System.out.println(nt.format(baifen));
设置百分比
猜你喜欢
转载自jyh-huhu.iteye.com/blog/2241263
今日推荐
周排行