Java tutorial
import java.util.Formatter; import java.util.Locale; public class Main { public static void main(String[] args) { StringBuffer buffer = new StringBuffer(); Formatter formatter = new Formatter(buffer, Locale.US); // format a new string String name = "from java2s.com"; formatter.format(Locale.US, "Hello %s !", name); // print the formatted string with specified locale System.out.println(formatter + " " + formatter.locale()); } }