//假設byte 長度為4 public int[] parserChannelIndex(byte[] data) { int[] byte2Int= new int[2]; int index = 0; for (int i = 0; i < data.length; i += 2) { byte hb = data[i + 1]; byte lb = data[i]; byte2Int[index] = ((int) hb << 8) | ((int) lb & 0xFF); index++; } return byte2Int; }
沒有留言:
張貼留言