Encode String to UTF-8

How about using

ByteBuffer byteBuffer = StandardCharsets.UTF_8.encode(myString)

Leave a Comment