android - Cast in java unsigned types -
i read in java there not unsigned data types. need send message:
a5a5 0008 f005 0001 00000003 uin16 uint16 uint16 uint16 uint32
i did this:
int prefijo = 0xa5a5; int numbytes = 0x0008; int tipo = 0xf005; int id = 0x0001; long estado = 0x00000003;
is correct way? , need push information in byte [] send device. how can do???
byte[] bytes = new byte[12];
thanks
short
uses 16 bitsint
uses 32 bitslong
uses 64 bits
in case, using hexadecimal values, sign can ignored:
byte b=(byte)0x81; //1000 0001
it works no matter sign gets in decimal "interpretation".
said so, should use short first 4 numbers , int last one.
Comments
Post a Comment