Method to Insert Commas into Large Numbers
java, number-formatting
Solution
With `NumberFormat` you can do this easily:
NumberFormat format = NumberFormat.getInstance(Locale.US);
System.out.println(format.format(100));
System.out.println(format.format(1000));
System.out.println(format.format(1000000));
will ouput:
100
1,000
1,000,000
Problem
Is there a method that already exists and if not can a method be written that can format large numbers and insert commas into them? ``` 100 = 100 1000 = 1,000 10000 = 10,000 100000 = 100,000 1000000 = 1,000,000 public String insertCommas(Integer largeNumber) { } ```