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