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