Locale locale = new Locale("zh","CN");
NumberFormat currFmt = NumberFormat.getCurrencyInstance(locale);
double amt = 123456.78;
System.out.println(currFmt.format(amt));//¥123,456.78
Date date = new Date();
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
System.out.println(df.format(date));//2017-6-25
String pattern1 = "{0},你好!你于 {1} 在工商银行存入 {2} 元。";
String pattern2 = "At {1,time,short} On {1,date,long},{0} paid {2,number, currency}.";
//②用于动态替换占位符的参数
Object[] params = {"John", new GregorianCalendar().getTime(), 1.0E3};
//③使用默认本地化对象格式化信息
String msg1 = MessageFormat.format(pattern1, params);
//④使用指定的本地化对象格式化信息
MessageFormat mf = new MessageFormat(pattern2, Locale.US);
String msg2 = mf.format(params);
System.out.println(msg1); //John,你好!你于 17-6-25 下午8:29 在工商银行存入 1,000 元。
System.out.println(msg2); //At 8:29 PM On June 25, 2017,John paid $1,000.00.