Integer shortValue() Method in Java Last Updated : 05 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The Integer.shortValue() is an inbuilt method of java.lang which returns the value of this Integer in the short type . Syntax: public short shortValue() Parameters: The method does not take any parameters. Return Value: The method returns the integer value represented by this object after converting it to type short. Below programs illustrate the Integer.shortValue() method: Program 1: For positive integers. Java // Java program that demonstrates // Integer.shortValue() method import java.lang.*; public class Geeks { public static void main(String[] args) { Integer sh_object = new Integer(763); // It will return the value of this Integer as a short type short sh_value = sh_object.shortValue(); System.out.println(" The Value of sh_value = " + sh_value); } } Output: The Value of sh_value = 763 Program 2: For negative number. Java // Java program that demonstrates // Integer.shortValue() method import java.lang.*; public class Geeks { public static void main(String[] args) { Integer sh_object = new Integer(-43); // It will return the value of this Integer as a short type short sh_value = sh_object.shortValue(); System.out.println(" The Value of sh_value = " + sh_value); } } Output: The Value of sh_value = -43 Program 3: For a decimal value and string. Note: It returns an error message when a decimal value and string is passed as an argument. Java // java program that demonstrates // Integer.shortValue() method import java.lang.*; public class Geeks { public static void main(String[] args) { // passing a decimal value Integer sh_object = new Integer(27.51); short sh_value = sh_object.shortValue(); System.out.println(" The Value of sh_value = " + sh_value); // passing a string Integer sh_object2 = new Integer("51"); short sh_value2 = sh_object2.shortValue(); System.out.println(" The Value of sh_value2 = " + sh_value2); } } Output: prog.java:10: error: no suitable constructor found for Integer(double) Integer sh_object = new Integer(27.51); ^ constructor Integer.Integer(int) is not applicable (argument mismatch; possible lossy conversion from double to int) constructor Integer.Integer(String) is not applicable (argument mismatch; double cannot be converted to String) 1 error Comment More infoAdvertise with us Next Article Integer shortValue() Method in Java A ankita_chowrasia Follow Improve Article Tags : Java Java-lang package Java-Functions Java-Integer Practice Tags : Java Similar Reads Integer sum() Method in Java The java.lang.Integer.sum() is a built-in method in java that returns the sum of its arguments. The method adds two integers together as per the + operator. Syntax : public static int sum(int a, int b) Parameter: The method accepts two parameters that are to be added with each other: a : the first i 2 min read Integer signum() Method in Java The signum function is an odd mathematical function that extracts the sign of a real number. The signum function is also known as sign function. The Integer.signum() method of java.lang returns the signum function of the specified integer value. For a positive value, a negative value and zero the me 3 min read Short shortValue() Method in Java The shortValue() is an inbuilt method of the Short class in Java and is used to return the Short value of this value. Syntax: public short shortValue() Parameters: The method does not take any parameter. Return Value: The method returns the numeric value represented by this object after conversion t 2 min read Integer toOctalString() Method in Java Octal is the base-8 number system and uses the digits 0 to 7 in operation. Octal is widely used in computing on systems like the PDP-8, and IBM mainframes employed 12-bit, 24-bit or 36-bit words. The Java.lang.Integer.toOctalString() method is a built-in function in Java that is used to return a str 3 min read Integer decode() Method in Java It is often seen that any integer within (" ") is also considered as string, then it is needed to decode that into the integer. The main function of java.lang.Integer.decode() method is to decode a String into an Integer. The method also accepts decimal, hexadecimal, and octal numbers. Syntax : publ 2 min read Like