Android : Byte array greater than 255

on Monday, September 1, 2014


I get to be a tool bluetooth number of 16-bit and I need to convert it to a string. I am able to obtain a number up to 255 in this way:



byte[] readBuf = (byte[]) msg.obj;
String strIncom = new String(readBuf);
char c = strIncom.charAt(0);


definitely receive up to 255 because "byte" it is 8-bit. I tried to replace bytes with short but I get this error:



byte[] cannot be cast to short[]

0 comments:

Post a Comment