Java Long signum Example
Long class signum method example.
Long class signum method example. This example shows you how to use signum method. This method generates the sign representation of argumen passed number
Syntax:- signum(long i)
Here is the code:-
/**
* @(#) SignumLong.java
* SignumLong class demonstrates the working of signum()method of Long class of lang package
* @version 9-May-2008
* @author Rose India Team
*/
public class SignumLong {
public static void main(String args[]) {
// actually this method gives th real number representation or you can
// say sign of argument
// passed number
// here the signum method generates number one(1) when passed datatype
// value is less than zero
// similarly it generates number minus one(-1) when passed datatype
// value is greater than zero
long value = 10246348;
long value1 = -2124324;
System.out
.println(Long.signum(value)
+ " --here method returns one because passed long value is greater than zero");
System.out
.println(Long.signum(value1)
+ " --here method returns minus one because passed long value is less than zero");
}
} |
null
|