Android examples for java.lang:Double
Format decimal number in #0.0 format
import java.text.DecimalFormat; public class Main { public static String toOneDecimal(String value) { Double d = 0d;//www . ja v a2 s .com try { d = Double.parseDouble(value); } catch (Exception e) { } DecimalFormat format = new DecimalFormat("#0.0"); String buf = format.format(d).toString(); return buf; } }