short 数组和int转换成byte数组

short[]转换成byte[]

byte a[] = new byte[out.length * 2];
		for (int i = 0; i < out.length; i++) {
			a[i * 2] = (byte) (out[i] & 0xFF);
			a[i * 2 + 1] = (byte) ((out[i] >> 8) & 0xff);
		}
整数转换成byte[]


	header[4] = (byte) (len & 0xff);
		header[5] = (byte) (len >> 8 & 0xff);
		header[6] = (byte) (len >> 16 & 0xff);
		header[7] = (byte) (len >> 24 & 0xff);

 

你可能感兴趣的:(音频)