0

How do I format a number?

Share:

If you want to display some numbers that is formatted to a certain pattern, either in a Java Swing application or in a JSP file, you can utilize NumberFormat and DecimalFormat class to give you the format that you want. Here is a small example that will show you how to do it.

Here is the different result of the code above.

Filed in: Java Text Package
© 2014 Java Examples - Built with love by Wayan Saryada.