/Users/lyon/j4p/src/utils/FormatTest.java

1    package utils; 
2     
3     
4    public class FormatTest { 
5      public static void main(String args[]) { 
6        java.text.DecimalFormat twoDigits = new java.text.DecimalFormat("$000.00"); 
7        System.out.println(twoDigits.format(1)); 
8        System.out.println(twoDigits.format(100)); 
9        System.out.println(twoDigits.format(0.8)); 
10    
11     } 
12   }