- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert a String to a byte number in Java
Use the parseByte() method in Java to convert a String to a byte.
Let’s say the following is our string −
String str = “76”;
Now, the parseByte() method converts the string to byte −
byte val = Byte.parseByte(str);
The following is an example −
Example
public class Demo { public static void main(String[] args) throws Exception { String str = "76"; byte val = Byte.parseByte(str); System.out.println(val); } }
Output
76
- Related Articles
- Convert byte to String in Java
- How to convert a byte array to a hex string in Java?
- How to convert a byte array to hex string in Java?
- Java Program to convert byte to string
- Java Program to convert string to byte
- Convert byte Array to Hex String in Java
- Convert Hex String to byte Array in Java
- Java Program to convert byte[] array to String
- Java Program to convert String to byte array
- Convert string to a number in Java
- How to convert hex string to byte Array in Java?
- Convert a byte to hexadecimal equivalent in Java
- Convert a String to a short number in Java
- Convert a String to a double type number in Java
- Convert byte primitive type to Byte object in Java

Advertisements