需求计算百分比,直接上代码 float percentage = 0.00f; int i= ****; int j= ****; if (j!= 0){j percentage = (float) i/j; } NumberFormat percentFormat = NumberFormat.getPercentInstance(); String formattedValue = percentFormat.format(percentage);