converter string em byte java
String example = "Convert Java String";
byte[] bytes = example.getBytes();
Old-fashioned Owl
String example = "Convert Java String";
byte[] bytes = example.getBytes();
b := []byte("ABC€")
s := string([]byte{65, 66, 67, 226, 130, 172})
String str = "Example String";
byte[] b = str.getBytes();
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));
}
}
String s = new String(bytes, StandardCharsets.UTF_8);