Java Decimal Format addDouble(Integer i, Double d)

Here you can find the source of addDouble(Integer i, Double d)

Description

add Double

License

Open Source License

Declaration

public static Integer addDouble(Integer i, Double d) 

Method Source Code


//package com.java2s;
import java.text.DecimalFormat;

public class Main {
    private static DecimalFormat integerFormatter = new DecimalFormat("######0");

    public static Integer addDouble(Integer i, Double d) {
        if (d == null && i == null) {
            return null;
        } else if (d == null && i != null) {
            return i;
        } else if (d != null && i == null) {
            return Integer.valueOf(integerFormatter.format(d));
        } else {//w  ww  . jav  a  2s .co m
            return i + Integer.valueOf(integerFormatter.format(d));
        }
    }
}

Related

  1. adjust(Double lng, Double lat, Double distance, Double angle)
  2. adjustDoubleNumber(Double doubleNumber, int maxIntPart, int maxFloatPart)
  3. createMeanRmsString(double values[])
  4. decimal2percent(double decimal, int pos)