Here you can find the source of formatPercent(final long value, final long total)
public static String formatPercent(final long value, final long total)
//package com.java2s; import java.text.DecimalFormat; public class Main { private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("##0.00%"); public static String formatPercent(final long value, final long total) { return formatPercent((double) value / total); }/*from w w w . j a va 2 s . c om*/ public static String formatPercent(final double percent) { return PERCENT_FORMAT.format(percent); //return GMath.roundTo(percent * 100, 2) + "%"; } }