devxlogo

April 26, 2005

An Efficient Method of String Concatenation

A good way to concatenate strings in a loop or when performing multiple concatenations, is to use the StringBuilder class: String s = “a”s+=”b”; //this is slowStringBuilder sb = new

Get All Locales Supported by the Java Runtime

This code segment returns all the locales supported by the Java Runtime: // ListSupportedLocales.javaimport java.util.*;// other code to go here.Locale[] localeList = Locale.getAvailableLocales( ); for (int i=0; i