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 =>
String.format("%.2fM", theNumber/ 1000000.0);
For more information see the String.format javadocs.