Integer byteValue()
Java Integer byteValue() method
Last Updated : 17 Mar 2025
The byteValue() is a method of byte class under java.lang package. It converts the given number into a primitive byte type and returns the value of integer object as byte. Also, it override the byteValue() method of Number class.
Syntax
Following is the declaration of byteValue() method:
Parameter:
| DataType | Parameter | Description |
|---|---|---|
| byte | NA | It returns the value of integer object as byte |
Returns:
The byteValue() method returns the numeric value represented by this object after conversion to the primitive byte type.
Exceptions:
NA
Compatibility Version:
Java 1.5 and above
Example 1
Output:
Enter the Desired Numeric Value: 55 The Value of Byte is: 55
Example 2
Output:
34
Example 3
Output:
The Byte object is: 80 Primitive byte value of Byte object is: 80
Example 4
Output:
b = -1 i2 = 255
Next TopicJava-integer-compare-method