- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Integer.signum() method in Java
The method returns the signum function of the specified int value. Let us now see the syntax.
int signum(int i)
Here is the parameter.
- i − This is the int value
The return value is -1 if the specified value is negative, 0 if the specified value is zero and 1 if the specified value is positive.
Let us now see an example.
Example
public class Demo { public static void main(String []args) { System.out.println("Returns = "+Integer.signum(0)); System.out.println("Returns = "+Integer.signum(-99)); System.out.println("Returns = "+Integer.signum(678)); } }
Output
Returns = 0 Returns = -1 Returns = 1
Advertisements