Here you can find the source of FormatFolat(Float num)
public static Float FormatFolat(Float num)
//package com.java2s; import java.text.DecimalFormat; public class Main { public static Float FormatFolat(Float num) { if (num == null) { return null; }/*from ww w.j av a 2 s. c o m*/ int p_num = num.toString().indexOf("."); if (((num.toString().length()) - p_num - 1) > 5) { if (Integer.parseInt(num.toString().substring(p_num + 6, p_num + 7)) >= 5) { num = num + new Float(0.000001); } } DecimalFormat df = new DecimalFormat("####.00000"); return new Float(df.format(num)); } }