shortValue(): This method is available in java.math.BigInteger class of Java.
Syntax:
short java.lang.Number.shortValue()
This method returns the value of the specified number as a short. This implementation returns the result of intValue cast to a short.
Returns: the numeric value represented by this object after conversion to type short.
For Example:
BigInteger bigInteger = new BigInteger("1234")
bigInteger.shortValue() = > It returns 1234.
Approach
Java
import java.math.BigInteger;public class BigIntegershortValue {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("1234");System.out.println(bigInteger.shortValue());}}
Output:
1234
No comments:
Post a Comment