Konversi string ke byte java
String example = "Convert Java String";
byte[] bytes = example.getBytes();
Old-fashioned Owl
String example = "Convert Java String";
byte[] bytes = example.getBytes();
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));
}
}