
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Byte Array to String in Java
To convert byte[] to String, firstly let us declare and initialize a byte array.
// byte array byte[] arr = new byte[] {78, 79, 33};
Now take a String and include the array in it.
String str = new String(arr);
Let us see the complete example to convert byte array to String.
Example
public class Demo { public static void main(String args[]) { // byte array byte[] arr = new byte[] {78, 79, 33}; String str = new String(arr); // string System.out.println("String = "+str); } }
Output
String = NO!
Advertisements