Integer.signum(int i) has the following syntax.
public static int signum(int i)
In the following code shows how to use Integer.signum(int i) method.
/*from w w w . j a v a2s . c o m*/ public class Main { public static void main(String[] args) { // returns 1 as int value is greater than 1 System.out.println(Integer.signum(5)); // returns -1 as int value is less than 1 System.out.println(Integer.signum(-5)); // returns 0 as int value is equal to 0 System.out.println(Integer.signum(0)); } }
The code above generates the following result.