Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Java Program to convert byte[] array to String
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
