Formatting Numbers in Java

By Lon Hosford

To avoid complicated digit hacking code to format numbers you can use the Java API NumberFormat and DecimalFormat classes among others. Here are tutorial links:

 
General page at Java on for formatting Numbers in Java: http://java.sun.com/docs/books/tutorial/i18n/format/numberintro.html
 
Link from general page for predefined number formats: http://java.sun.com/docs/books/tutorial/i18n/format/numberFormat.html
 
Link from general page for custom number formats: http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html