Converting int to byte in Android

前端 未结 4 1073
囚心锁ツ
囚心锁ツ 2020-12-21 07:49

Actually I need to transfer the integer value along with the bitmap via bluetooth.. Now my problem is I need to transfer the in

4条回答
  •  我在风中等你
    2020-12-21 08:14

    A single byte (8 bits) can only contain 2^8 unsigned integers, i.e [0, 255]. For signed you loose the first bit and the range becomes [-128, 127]. If your integer fits then a simple cast should work.

提交回复
热议问题