Android examples for java.lang:Double
format Number with single decimal place
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String formatNumber1D(double value) { return formatNumber(value, "0.0"); }//from w ww .j a va2 s. co m public static String formatNumber(double value, String format) { DecimalFormat decimalFormat = new DecimalFormat(format); return decimalFormat.format(value); } public static String formatNumber(double value) { return formatNumber(value, "0"); } }