Java tutorial
//package com.java2s; import java.text.NumberFormat; public class Main { public static String percent(double p1, double p2) { String str; double p3 = p1 / p2; NumberFormat nf = NumberFormat.getPercentInstance(); nf.setMinimumFractionDigits(2); str = nf.format(p3); return str; } }