大端小端排序 补码反码

大端排序

/*
 * byte[]数组转short类型,大端排序
 */
public static short bytes2ShortBig(byte[] bytes, int startIndex) {
    byte high = bytes[startIndex];
    byte low = bytes[startIndex + 1];
    short z = (short) (((high & 0xFF) << 8) | (0xFF & low));
    return z;
}
原文地址:https://www.cnblogs.com/kikyoqiang/p/15009867.html