java byte[] 的骚操作

类似于C数组的操作

byte[] bytetest = {0x01,0x03};

实现C语言的常量结构体数组

        class AnsData {
            public byte[] req_buf;
            public byte[] ans_buf;
            public AnsData(byte[] str_in, byte[] str2){
                req_buf = str_in;
                ans_buf = str2;
            }
        };

        AnsData[] AnsDataLib = {
                new AnsData(new byte[]{0x01, 0x03}, new byte[]{0x43,0x00}),
                new AnsData(new byte[]{0x01,0x07}, new byte[]{0x47,0x00}),
        };

 

posted on 2020-11-06 11:55  lizhuohui  阅读(100)  评论(0编辑  收藏  举报

导航