Here you can find the source of utf8Encode(String str)
public static byte[] utf8Encode(String str)
//package com.java2s; //License from project: Open Source License import java.nio.charset.StandardCharsets; public class Main { public static byte[] utf8Encode(String str) { return str.getBytes(StandardCharsets.UTF_8); }// w w w .j a v a 2s .co m }