Skip to content

Instantly share code, notes, and snippets.

@ShanikaNishadhi
Created March 29, 2019 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShanikaNishadhi/d2339d63f0a95b5f0119a575b0a863fe to your computer and use it in GitHub Desktop.
Save ShanikaNishadhi/d2339d63f0a95b5f0119a575b0a863fe to your computer and use it in GitHub Desktop.
import java.util.Locale;
import java.text.NumberFormat;
class LocaleConstantExample {
public static void main(String[] args) {
Locale deLocale = Locale.GERMANY;
Locale usLocale = Locale.US;
long number = 123456789L;
NumberFormat denf = NumberFormat.getInstance(deLocale);
NumberFormat usnf = NumberFormat.getInstance(usLocale);
System.out.println( denf.format(number) );
System.out.println( usnf.format(number) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment