Here you can find the source of formataValor(Double valor)
public static String formataValor(Double valor)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { public static final String LOCALE_LANGUAGE = "pt"; public static final String LOCALE_COUNTRY = "BR"; public static String formataValor(Double valor) { NumberFormat nf = NumberFormat.getInstance(new Locale(LOCALE_LANGUAGE, LOCALE_COUNTRY)); nf.setMinimumFractionDigits(2);/* w w w. j a v a2 s . c om*/ nf.setMaximumFractionDigits(2); nf.setMinimumIntegerDigits(1); return nf.format(valor); } }