Java Number Format Pattern formatInteger(Object obj)

Here you can find the source of formatInteger(Object obj)

Description

format Integer

License

Apache License

Declaration

public static String formatInteger(Object obj) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;

public class Main {
    public static String formatInteger(Object obj) {
        if (obj == null) {
            return "";
        } else {// w  w  w .j  av a2s. c o m
            try {
                Integer ival = (Integer) obj;
                DecimalFormat intFormat = new DecimalFormat("###,###,###,##0");
                return intFormat.format(ival);
            } catch (Exception e) {
                return "bad Integer in FormatUtils:" + obj.toString() + " Error:" + e.getMessage();
            }
        }
    }
}

Related

  1. formatGopNumber(Number gop)
  2. formatI18N(Object ob)
  3. formatiereSpeichergroesse(long bytes)
  4. formatIncludeCommas(final Number object)
  5. formatInt(final int number)
  6. formatIntoCurr(String str_number, int digits)
  7. formatLong(long value)
  8. formatNumber(final long number)
  9. formatNumber(final long number)