Java examples for java.lang:int Format
format Integer
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String formatInteger(Object obj) { String out = ""; if (obj == null) { return out; }//w w w . j a v a 2 s. c o m try { Integer ival = (Integer) obj; DecimalFormat intFormat = new DecimalFormat("###,###,###,##0"); out = (new StringBuilder()).append(out) .append(intFormat.format(ival)).toString(); } catch (Exception e) { out = (new StringBuilder()).append(out) .append("bad Integer in FormatUtils:") .append(obj.toString()).append(" Error:") .append(e.getMessage()).toString(); } return out; } }