Here you can find the source of format(Float f)
public static String format(Float f)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { static DecimalFormat df = new DecimalFormat("0.00"); public static String format(Double d) { return df.format(d); }//from w w w . ja v a 2s .c o m public static String format(Float f) { return df.format(f); } }