Java Integer signum() MethodThe signum() method of Java Integer class returns the signum function of the specified int value in the method argument. The signum function can be computed as:
Syntax:Following is the declaration of signum() method: Parameter:
Returns:The signum() method returns the signum function of the specified int value in the method argument. Exceptions:NA Compatibility Version:Java 1.5 and above Example 1Test it NowOutput: Result: 1 Result: -1 Result: 0 Example 2Output: Enter Positive Value: 4565 Result: 1 Enter Negative Value: -432 Result: -1 Enter Zero Value: 000 Result: 0 Example 3Test it NowOutput: Output: NaN Output: 0.0 Output: 0.0
Next Topicsum() Method
|