Here you can find the source of formatMetricsDecimal(double value)
public static String formatMetricsDecimal(double value)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { public static final String NO_METRICS_LABEL = "-"; public static String formatMetricsDecimal(double value) { //TODO: thread-safety of number format? //TODO: localisation? if (value == -1 || Double.isNaN(value) || Double.isInfinite(value)) { return NO_METRICS_LABEL; } else {//from w ww . j av a2 s .c o m return getDecimalFormatter().format(value); } } private static NumberFormat getDecimalFormatter() { NumberFormat format = DecimalFormat.getNumberInstance(); format.setMinimumFractionDigits(1); format.setMaximumFractionDigits(1); return format; } }