Java Abs abs(short x)

Here you can find the source of abs(short x)

Description

Returns the absolute value of a short value

License

Open Source License

Parameter

Parameter Description
x a parameter

Declaration

public static short abs(short x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w w  w .  j  av a2  s  . c o  m*/
     * Returns the absolute value of a short value
     * @param x
     * @return
     */
    public static short abs(short x) {
        x *= x < 0 ? -1 : 1;
        return x;
    }
}

Related

  1. abs(int val)
  2. abs(int value)
  3. abs(int x)
  4. abs(long index)
  5. Abs(Object in)
  6. abs2(double[][] IN)
  7. abs2(float[] f)
  8. abs_fractional(double number)
  9. abs_min(double a, double b)