The signum() method of Java Integer class returns the signum function of the specified int value.

Syntax

public static int signum (int i)

 Parameters

The parameter ‘i’ represents the value whose signum is to be determined.

 Return Value

This method returns the signum function of the specified int value.

  • It returns -1, if the specified int value is negative.
  • It returns 0, if the specified int value is zero.
  • It returns 1, if the specified int value is positive.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This