Android examples for java.lang:Byte Array
convert string To byte array in Unicode
import java.io.UnsupportedEncodingException; public class Main{ public static byte[] convertToUnicode(String str) { byte[] result = null; try {/*from w w w . jav a 2 s. c om*/ byte[] res = str.getBytes("utf-8"); result = new byte[res.length + 1]; for (int i = 0; i < res.length; i++) { result[i] = res[i]; } } catch (UnsupportedEncodingException localUnsupportedEncodingException) { } return result; } }