我对如何将short数组转换为byte数组感到困惑.我有下面的short数组
short[] shrt_array = new short[]{ 0x4 , 0xd7 , 0x86, 0x8c, 0xb2, 0x14, 0xc, 0x8b, 0x2d, 0x39, 0x2d, 0x2d, 0x27, 0xcb, 0x2e, 0x79, 0x46, 0x36, 0x9d , 0x62, 0x2c };
Run Code Online (Sandbox Code Playgroud)
通过使用此链接将短数组转换为字节数组这两种转换方法,我得到以下两个不同的byte数组:
expectedByteArray = new byte[] {
(byte) 0x4, (byte) 0xd7, (byte) 0x86,
(byte) 0x8c, (byte) 0xb2, (byte) 0x14,
(byte) 0xc, (byte) 0x8b, (byte) 0x2d,
(byte) 0x39, (byte) 0x2d, (byte) 0x2d,
(byte) 0x27, (byte) 0xcb, (byte) 0x2e,
(byte) 0x79, (byte) …Run Code Online (Sandbox Code Playgroud)