java parseShort parseInt

    private static short parseShort(byte[] data, int offset) {
        return (short) ((data[offset] & 0xFF) << 8 | (data[offset + 1] & 0xFF));
    }

    private static int parseInt(byte[] data, int offset) {
        return (data[offset] & 0xFF) << 24 | (data[offset + 1] & 0xFF) << 16 | (data[offset + 2] & 0xFF) << 8 | (data[offset + 3] & 0xFF);
    }

 

posted on 2025-08-04 14:11  yebinghuai-qq-com  阅读(16)  评论(0)    收藏  举报

导航