Here you can find the source of getPercent(long l1, long l2)
public static String getPercent(long l1, long l2)
//package com.java2s; //License from project: LGPL import java.text.DecimalFormat; public class Main { public static String getPercent(long l1, long l2) { final double ratio = l1 / (double) l2; if (ratio < 0.001d) { return "<0.1%"; }/* w w w . ja v a 2s .c o m*/ final DecimalFormat percentFormat = new DecimalFormat("#.#%"); return percentFormat.format(ratio); } }