// 获取百分比,不带小数点 private String getPercentage(String num, String total){ NumberFormat numberFormat = NumberFormat.getInstance(); numberFormat.setMaximumFractionDigits(2); return numberFormat.format( (float)Integer.valueOf(num) / (float)Integer.valueOf(total) * 100 ); }