0
這是我的問題:我需要將字節數組轉換爲int,在xamarin pcl上。 但我有tryed這一點:將字節數組轉換爲xamarin pcl c中的int#
byte[] fromBoardSerial = new byte[3];
fromBoardSerial[0] = 0x04
fromBoardSerial[1] = 0x93
fromBoardSerial[2] = 0xe0
result = BitConverter.ToInt32(fromBoardSerial, 0);
解決方案:
Array.Reverse(fromBoardSerial); //call before conversion
但結果是:-527236096 ... ..而是正確的結果應該是:300000 如何從int中的數組字節進行轉換?
感謝
一定有什麼東西錯一個整數由4個字節? – NtFreX
是的是正確的...如果你會嘗試它:http://www.binaryhexconverter.com/hex-to-decimal-converter –