Here you can find the source of singleDecimalDigit(double d)
public static String singleDecimalDigit(double d)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static String singleDecimalDigit(double d) { return new DecimalFormat("#.#").format(d); }//from ww w . j a v a 2 s. c o m }