Locale defaultLocale = Locale.getDefault(); System.out.println("Default Locale: " + defaultLocale);
double number = 12345.6789; NumberFormat nf = NumberFormat.getNumberInstance(); String formatted = nf.format(number); System.out.println("Formatted number: " + formatted);This code will format the number 12345.6789 using the default Locale. The output will vary depending on the region of the system. For example, "12,345.679" in the United States and "12 345,679" in France. This method is part of the java.util package library.