Here you can find the source of formatFloat(String format, double f)
public static String formatFloat(String format, double f)
//package com.java2s; //License from project: Apache License public class Main { public static String formatFloat(String format, double f) { StringBuffer formatString = new StringBuffer(format); java.text.DecimalFormat df = new java.text.DecimalFormat(formatString.toString()); return df.format(f); }//from w w w . j a v a2 s . co m }