Fórum Decimal Format #567155
18/08/2009
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Segue abaixo meu codigo: package decimal_format; import java.text.DecimalFormat; public class ExemploDecimalFormat { public static void main(String[] args) { DecimalFormat df = new DecimalFormat(); df.applyPattern("R$ #,##0.00"); double numero = 15000; System.out.println(df.format(numero)); } } |

Rogerio Balestra
Curtir tópico
+ 1Posts
18/08/2009
Flávio Mendes
1 2 3 4 5 6 7 8 | public class Main1 { public static void main(String[] args) { double valor = 15000; String formato = "R$ #,##0.00"; DecimalFormat d = new DecimalFormat(formato); System.out.println(d.format(valor)); } } |
Gostei + 0
19/08/2009
Carlos Heuberger
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Segue abaixo meu codigo: package decimal_format; import java.text.DecimalFormat; public class ExemploDecimalFormat { public static void main(String[] args) { DecimalFormat df = new DecimalFormat(); df.applyPattern("R$ #,##0.00"); double numero = 15000; System.out.println(df.format(numero)); } } |
1 2 3 | NumberFormat df = NumberFormat.getCurrencyInstance(new Locale("pt", "BR")); double numero = 15000; System.out.println(df.format(numero)); |
1 2 3 4 5 6 | Locale.setDefault(new Locale("pt", "BR")); // mudança global DecimalFormat df = new DecimalFormat(); df.applyPattern("R$ #,##0.00"); double numero = 15000; System.out.println(df.format(numero)); |
Gostei + 0
19/08/2009
Rogerio Balestra
Gostei + 0
19/08/2009
Krisnamourt Filho
Gostei + 0
19/08/2009
Carlos Heuberger
Gostei + 0