int转byte[]优化算法
我想有个算法目的是将Int分散到byte中去。
现在的算法是
参数(int i)
byte[] result=new byte[4];
result[0]=(byte)(0xff&i);
result[1]=(byte)((0xff00&i)>>8);
result[2]=(byte)((0xff0000&i)>>16);
result[3]=(byte)((0xff000000&i)>>24);
return result;
请问有没有更好的方法。
因为这个方法时不时会出现 0-70毫秒左右的延迟