Java Abs abs(Double d)

Here you can find the source of abs(Double d)

Description

calculate the absolute value of a double

License

Apache License

Parameter

Parameter Description
d double

Return

absolute value of d

Declaration

public static double abs(Double d) 

Method Source Code

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

public class Main {
    /**/*w ww  .j av  a  2  s.  co m*/
     * calculate the absolute value of a double
     *
     * @param d double
     * @return absolute value of d
     */
    public static double abs(Double d) {
        if (d < 0) {
            return -1 * d;
        } else {
            return d;
        }
    }
}

Related

  1. abs(Double a)
  2. abs(double d)
  3. abs(double d1)
  4. abs(double n)
  5. abs(double number)