In this section, we are going to convert a long type data into a byte. The following program provides you the functionality to convert into a long to byte.
Code Description:
This program defines a class named is "LongToByte". This class wraps a value of the primitive type long in an object. This is a long type object that contains a single. For converting this, you simply use the type casting process like: byte bValue = (byte) num; statement and it converted into a byte format.
Here is the code of this program given below:
import java.io.*;
|
Output of this program given below.
| C:\corejava>java LongToByte Enter the long value: 65 Byte is:65 C:\corejava> _ |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert Long To Byte View All Comments
Post your Comment