Here you can find the source of formatAmount(float f)
Parameter | Description |
---|---|
str | a parameter |
public static String formatAmount(float f)
//package com.java2s; import java.text.DecimalFormat; public class Main { /**//w w w . j a v a 2 s. com * 12->12.00 or 11111.1 -> 1,111.10 * * @param str * @return */ public static String formatAmount(float f) { try { DecimalFormat df = new DecimalFormat("###,###.00"); return df.format(f); } catch (Exception e) { return ""; } } }