67,513
社区成员
发帖
与我相关
我的任务
分享
1、取整数 int getInt(byte[] bytes, int startIndex, int len)
2、取实数 double getDouble(byte[] bytes, int startIndex, int len, int ratio)
3、取字符串 String getStr(byte[] bytes, int startIndex, int len)
参数含义:
bytes 接收到的数据包(字节流)
startIndex 本信息域在字节流中的起始索引
len 本信息域所占用的字节数
ratio 小数位数,如果该参数是1,则表明整数部分的分辨率是0.1,即整数部分需除以10才是真正的数据域;
如果该参数位2,则表示整数值的分辨率是0.01,即整数值需除以100才是真正的信息域数值。