Here you can find the source of formatNum(float value)
public static float formatNum(float value)
//package com.java2s; //License from project: LGPL import java.text.DecimalFormat; public class Main { public static float formatNum(float value) { DecimalFormat df1 = new DecimalFormat("###.00"); return Float.parseFloat(df1.format(value)); }/*from ww w.j a v a2s.co m*/ }