Here you can find the source of formatNumber(float num, String format)
Parameter | Description |
---|---|
num | the float number value |
format | "##,###.##","##.##" |
true
if it is ascii;false
otherwise
public static String formatNumber(float num, String format)
//package com.java2s; import java.text.DecimalFormat; public class Main { /**// w w w .j a va2 s . c om * format the number * * * @param num the float number value * @param format "##,###.##","##.##" * @return <code>true</code> if it is ascii;<code>false</code> otherwise */ public static String formatNumber(float num, String format) { DecimalFormat df = new DecimalFormat(format); return df.format(num); } }