Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; public class Main { private static final String UTF_8_ENCODING = "UTF-8"; /** * @param message * @return byte[] * @throws UnsupportedEncodingException */ private static byte[] getByteArray(final String message) throws UnsupportedEncodingException { return message.getBytes(UTF_8_ENCODING); } }