java byte array to string
// string to byte[]
byte[] bytes = "hello".getBytes(StandardCharsets.UTF_8);
// byte[] to string
String s = new String(bytes, StandardCharsets.UTF_8);
java byte array to string
// string to byte[]
byte[] bytes = "hello".getBytes(StandardCharsets.UTF_8);
// byte[] to string
String s = new String(bytes, StandardCharsets.UTF_8);
String to Byte array Java
import java.util.Arrays;
public class StringToByte {
public static void main(String[] args) {
String str = "Example String";
byte[] b = str.getBytes();
System.out.println("Array " + b);
System.out.println("Array as String" + Arrays.toString(b));
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us