java 这个方法是干什么用的,

public static final int getIntFromBytes(byte[] b, int offset, int len)
        throws IOException {
    int num = 0;
    int sw = 8 * (len - 1);

    for (int loop = 0; loop < len; loop++) {
        num |= ((int) b[offset + loop] & 0x00ff) << sw;
        sw -= 8;
    }

    return num;
}

b是从网络接收来的一个byte数组

将从网络获取的字节流转换为int型数据,offset表示要转换的字节流的起始字节的索引,len表示要转换的字节流的长度