Java Decimal Format decimalFormat(Object obj)

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

Description

decimal Format

License

Apache License

Declaration

public static String decimalFormat(Object obj) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {

    public static String decimalFormat(Object obj) {
        if (null == obj)
            return "";
        DecimalFormat df = new DecimalFormat("0.00");
        return df.format(obj);
    }/*  ww  w  .  j a v  a 2s  . co m*/

    public static String decimalFormat(Object obj, String format) {
        if (null == obj)
            return "";
        DecimalFormat df = new DecimalFormat(format);
        return df.format(obj);
    }
}

Related

  1. decimalFormat(double d)
  2. decimalFormat(double no)
  3. decimalFormat(double number)
  4. decimalFormat(Double numeric)
  5. decimalFormat(double value, int decimalCnt)
  6. decimalFormat(String pattern)
  7. decimalFormat(String pattern, double value)
  8. decimalFormatLabel(final long value, final long divider, final String unit)
  9. decimalPointTwo(Float input)