Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String format1(double input) { DecimalFormat df = new DecimalFormat("#.#"); return df.format(input); } }