自己写一个吧 public static long ntohl(long in){ long out = 0; out = (in&0xff)<<24; out |= (in&0xff00)<<8; out |= (in&0xff0000)>>8; out |= (in&0xff000000)>>24; return out; }
我定义的是一个大小为4byte的数组。如byte[] len = new byte[4]。转换之后怎么把他放到这个数组里面去。楼上的转换以后也不是四位长度的呀?怎么做?急死了
long out = 0;
out = (in&0xff)<<24;
out |= (in&0xff00)<<8;
out |= (in&0xff0000)>>8;
out |= (in&0xff000000)>>24;
return out;
}