Is there a way to use DecimalFormat (or some other standard formatter) to format numbers like this:
1,000,000 => 1.00M 1,234,567 =>
1,000,000 => 1.00M
1,234,567 =>
For now, you should use ICU's CompactDecimalFormat, which will localize the formatting result for non-english locales. Other locales might not use a "Millions" suffix.
This functionality will be standard Java in JDK 12 with CompactNumberFormat.
CompactNumberFormat