package chapter14; import java.util.*; import java.text.*; public class TestNumForm { public static void main(String[] args) { GregorianCalendar now = new GregorianCalendar(); int woy = now.get(GregorianCalendar.WEEK_OF_YEAR); int y = now.get(GregorianCalendar.YEAR); NumberFormat percForm = NumberFormat.getPercentInstance(); percForm.setMinimumFractionDigits(1); String s = percForm.format(woy/52.0); System.out.println(s+" of "+y+" has passed..."); double saved = 185.0; NumberFormat moneyForm = NumberFormat.getCurrencyInstance(); System.out.println(moneyForm.format(saved)); Locale locale = new Locale("fr", "FR"); moneyForm = NumberFormat.getCurrencyInstance(locale); System.out.println(moneyForm.format(saved)); } }