code: public static final ByteArray copyFrom(String string) {
      return new ByteArray(ByteString.copyFrom(string, StandardCharsets.UTF_8));
    }
docs: Creates a {@code ByteArray} object given a string. The string is encoded in {@code UTF-8}. The
  bytes are copied.