Locale.toLanguageTag() has the following syntax.
public String toLanguageTag()
In the following code shows how to use Locale.toLanguageTag() method.
// w w w . j av a2 s. c o m import java.util.Locale; public class Main { public static void main(String[] args) { Locale locale = new Locale("ENGLISH"); System.out.println("Locale:" + locale); System.out.println(locale.toLanguageTag()); } }
The code above generates the following result.