We would like to know how to display a currency value with DecimalFormat.
import java.text.DecimalFormat; /*from w ww .j a v a 2s .c o m*/ public class Main { public static void main(String[] argv) throws Exception { DecimalFormat df = new DecimalFormat("\u00a4#,##0.00"); System.out.println(df.format(4232.19)); System.out.println(df.format(-4232.19)); } }
The code above generates the following result.