Here you can find the source of getPercent(final long downloadCurrent, final long downloadMax)
public static String getPercent(final long downloadCurrent, final long downloadMax)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.text.DecimalFormat; public class Main { public static String getPercent(final long downloadCurrent, final long downloadMax) { return (new DecimalFormat("0.00")).format(100.0 * downloadCurrent / downloadMax)//from w ww.ja v a 2 s . co m + "%"; } }