Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static float formatFloat(float value) { DecimalFormat df = new DecimalFormat(); String style = "0.0"; df.applyPattern(style); return Float.valueOf(df.format(value)); } }