Java Data Type How to - Format a number using the current Locale()


We would like to know how to format a number using the current Locale().


import java.text.NumberFormat;
import java.util.Locale;

public class Main {
  public static void main(String[] args) throws Exception {
   System.out.println(NumberFormat.getInstance(new Locale("us")).format(12345.12345)); 


The code above generates the following result.