You can use the DecimalFormat class to format your number.

Line 3: Create an instance of your object and give it the parameters particular to your needs.
Line 6. Call the method for formatting,...