Android examples for java.lang:Byte Array
get Byte array from string using bit shift
public class Main{ public static byte[] getBytes(String in) { byte[] result = new byte[in.length() * 2]; int output = 0; for (char ch : in.toCharArray()) { result[output++] = (byte) (ch & 0xFF); result[output++] = (byte) (ch >> 8); }//w w w . ja v a2s .c om return result; } }