java string to byte array utf8

Java
String s = "some text here";
byte[] b = s.getBytes(StandardCharsets.UTF_8);
Source

Also in Java: