Here you can find the source of toPercent(float f)
public static String toPercent(float f)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String toPercent(float f) { if (Float.isNaN(f)) { return "0"; }//ww w . j av a 2 s . co m DecimalFormat df = new DecimalFormat("0.00"); return df.format(f); } }