As mentioned in earlier posts, the java.text.DecimalFormat class is used to format decimal numbers via predefined patterns specified as String.
Apart from the decimal separator, grouping separator, currency separator etc., It is also possible to mix String literals within the pattern.
The following example demonstrates embedding String literals within pattern:
The above code produces the following output:
My formatted number is 170,180.246