考虑以下for-each循环
String S = "";
byte[] sendingByte;
List<Integer> lst = new ArrayList<Integer>();
try {
ReadHoldRegisters(lst, 1, 1, 10);
for (int value : lst) {
S = S + String.format("%02x ", value);
}
etWrite.setText(S);
} finally {
// send modbus rtu byte[] array to USB serial port
}
ReadHoldRegisters
生成CRC16 ArrayList of Integer
的位置,而Java中的int
是签名值
如何将for-each循环中的int values
分配到byte[] sendingByte
数组?