Here you can find the source of abs(final double value)
Parameter | Description |
---|---|
value | Value to absolute. |
public static double abs(final double value)
//package com.java2s; /**//from w w w.j av a 2 s . c om * Static helper class to centralize various useful methods * that do not fit in any other util. * Copyright (c) 2015 Vinland Solutions * Creative Commons Attribution-NonCommercial <http://creativecommons.org/licenses/by-nc/3.0/deed.en_US> * @author JayJeckel <http://minecraft.jeckelland.site88.net/> */ public class Main { /** * Return absolute value. * @param value Value to absolute. * @return Absoluted value. */ public static short abs(final short value) { return (value < 0 ? (short) -value : value); } /** * Return absolute value. * @param value Value to absolute. * @return Absoluted value. */ public static int abs(final int value) { return (value < 0 ? -value : value); } /** * Return absolute value. * @param value Value to absolute. * @return Absoluted value. */ public static long abs(final long value) { return (value < 0 ? -value : value); } /** * Return absolute value. * @param value Value to absolute. * @return Absoluted value. */ public static float abs(final float value) { return (value < 0 ? -value : value); } /** * Return absolute value. * @param value Value to absolute. * @return Absoluted value. */ public static double abs(final double value) { return (value < 0 ? -value : value); } }