lizhanwei
2020-02-14 4e307b0d89c9a84916bbbc2119e41d34c6badc13
im_lib/src/main/java/com/anyun/im_lib/util/ByteUtil.java
@@ -190,8 +190,8 @@
     */
    public static byte[] shortGetBytes(short data) {
        byte[] bytes = new byte[2];
        bytes[0] = (byte) (data & 0xff);
        bytes[1] = (byte) ((data & 0xff00) >> 8);
        bytes[1] = (byte) (data & 0xff);
        bytes[0] = (byte) ((data & 0xff00) >> 8);
        return bytes;
    }
@@ -206,6 +206,17 @@
        short b = (short) 32768;
        b++;
        System.out.println(byte2HexStr(shortGetBytes((short) b)));
        String model = "123";
        byte[] messageBody = new byte[30];
        byte[] modelBytes = new byte[20];
        modelBytes =  model.getBytes();
        System.arraycopy(shortGetBytes((short)323),0,messageBody,0,2);
        System.arraycopy(modelBytes,0,messageBody,2,modelBytes.length);
        System.arraycopy(shortGetBytes((short)3),0,messageBody,22,2);
        System.out.println(byte2HexStr(messageBody));
    }
    public static byte[] subArray(byte[] srcBytes, int begin, int length) {