Here you can find the source of getFormatTwoPoint(float param)
public static float getFormatTwoPoint(float param)
//package com.java2s; public class Main { public static float getFormatTwoPoint(float param) { param += 0.001;//from w w w.ja v a 2 s. c o m java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00"); return Float.parseFloat(df.format(param)); } public static double getFormatTwoPoint(double param) { param += 0.001; java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00"); return Double.parseDouble(df.format(param)); } }