功能:把一段逗号分割字符串转换为byte数组
例子:String "4,2,1,13,14,4,7,22,13,12,23,6,23,28,8,3,12,3,22,10,3,12,24,13,16,17,4,22,13,26,23"
转换完毕后成为byte {4,2,1,13,14,4,7,22,13,12,23,6,23,28,8,3,12,3,22,10,3,12,24,13,16,17,4,22,13,26,23};
int validLength = 0;
for(int i = value.length; --i >= 0;) {
if(value[i] == ',') {
validLength++;
continue;
}
}
// System.out.println("validLength::" + validLength);
info = new byte[++validLength];
String script = new String(getText());
String sep = ",";
int begin = 0, end, index = 0;
while(true) {
end = script.indexOf(sep, begin);
if(end < 0) {
info[index++] = Byte.parseByte(script.substring(begin));
break;
}
info[index++] = Byte.parseByte(script.substring(begin, end));
begin = end + 1;
}