Here you can find the source of format(Integer num)
public static String format(Integer num)
//package com.java2s; //License from project: LGPL import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { static String numericFormat = "#,##0.00"; public static String format(Double num) { String result = ""; try {/* w w w. j a va2 s . com*/ result = new DecimalFormat(numericFormat).format(num); } catch (Exception e) { // TODO: handle exception } return result; } public static String format(Integer num) { String result = ""; try { result = format((double) num); } catch (Exception e) { // TODO: handle exception } return result; } public static String format(String num) { String result = ""; try { result = format(Double.parseDouble(num)); } catch (Exception e) { // TODO: handle exception } return result; } public static String format(BigDecimal num) { String result = ""; try { result = format(num.doubleValue()); } catch (Exception e) { // TODO: handle exception } return result; } }