numeric « Number Format « Java Data Type Q&A

1. Java: Format number in millions

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 ...

2. I need to provide to separate exception statements. 1. empty string and 2. valid numeric data

BufferedReader reader = new BufferedReader(new InputStreamReader(;
            System.out.println(" Enter the Amount of articles to be ordered.");