Here you can find the source of formatWithOneDecimal(Float value)
public static String formatWithOneDecimal(Float value)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { private static final DecimalFormat oneDecimalFormat = new DecimalFormat("##0.#"); public static String formatWithOneDecimal(Float value) { if (value == null) { return ""; }/*from w w w. j a va 2s .c om*/ return oneDecimalFormat.format(value); } public static String formatWithOneDecimal(Double value) { if (value == null) { return ""; } return oneDecimalFormat.format(value); } }