Here you can find the source of getPercent(double percent)
public static String getPercent(double percent)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String getPercent(double percent) { return new DecimalFormat("#.##").format(percent); }//from www.j av a2 s .co m public static String getPercent(float percent) { return new DecimalFormat("#.##").format(percent); } }