NOTA: La traducción de esta documentación es un esfuerzo personal y voluntario, no es un documento oficial de Sun Microsystems ni Oracle ni está patrocinado por ninguna de estas empresas. Los documentos originales (en inglés) están disponibles en: http://java.sun.com/docs/books/tutorial/.
Dirija cualquier comentario, petición, felicitación, etc. a tutorialesjava_@RROBA_codexion.com.
Si desea ayudar a mantener en funcionamiento esta web, colaborar con la traducción de estos documentos o necesita que se traduzca algĂșn capĂ­tulo en concreto puede realizar una donación directa mediante Paypal:
Numbers and Currencies (The Java™ Tutorials > Internationalization > Formatting)
Trail: Internationalization
Lesson: Formatting
Numbers and Currencies
Home Page > Internationalization > Formatting
Numbers and Currencies
Programs store and operate on numbers in a locale-independent way. Before displaying or printing a number, a program must convert it to a String that is in a locale-sensitive format. For example, in France the number 123456.78 should be formatted as 123 456,78, and in Germany it should appear as 123.456,78. In this section, you will learn how to make your programs independent of the locale conventions for decimal points, thousands-separators, and other formatting properties.

Using Predefined Formats

Using the factory methods provided by the NumberFormat class, you can get locale-specific formats for numbers, currencies, and percentages.

Formatting with Patterns

With the DecimalFormat class you specify a number's format with a String pattern. The DecimalFormatSymbols class allows you to modify formatting symbols such as decimal separators and minus signs.
Previous page: Formatting
Next page: Using Predefined Formats