Android examples for java.lang:Double
format double Number to string in #,##0.0 format
import java.text.DecimalFormat; public class Main{ public static String formatNumber(double d) { try {/*w w w .ja v a2 s .c o m*/ DecimalFormat df = new DecimalFormat("#,##0.0"); return df.format(d); } catch (Exception e) { } return ""; } public static String formatNumber(String d) { return formatNumber(Double.parseDouble(d)); } }