Java Number Sign signum(final int i)

Here you can find the source of signum(final int i)

Description

signum function.

License

Open Source License

Parameter

Parameter Description
i the function argument

Return

-1, 0 or 1 if the argument is negative, 0 or positive

Declaration

public static int signum(final int i) 

Method Source Code

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

public class Main {
    /**//from   ww  w  .j  a v  a2s.  co  m
     * signum function.
     * @param i the function argument
     * @return -1, 0 or 1 if the argument is negative, 0 or positive
     */
    public static int signum(final int i) {
        if (i < 0) {
            return -1;
        } else if (i > 0) {
            return 1;
        } else {
            return 0;
        }
    }
}

Related

  1. signum(Double d)
  2. signum(double value)
  3. signum(double z)
  4. signum(final double x)
  5. signum(final int a)
  6. signum(final int n)
  7. signum(final int value)
  8. signum(float f)
  9. signum(float val)