0
我有一個ArrayOfByte
轉換ArrayOFByte爲int []
Log.d(TAG, "arrayOfByte :"+arrayOfByte); // it will display arrayOfByte :[[email protected]
Log.d(TAG, "arrayOfByte :"+ Arrays.toString(arrayOfByte)); //it displays arrayOfByte :[1,1,2,1,3,3,3,2,0,0,0,0,0,0,0]
現在我想這個[1,1,2,1,3,3,3,2,0,0,0,0,0,0,0]
到一些int[ ] series
即:
int[ ] series ={1,1,2,1,3,3,3,2,0,0,0,0,0,0,0}
那麼如何可以做到這一點?
我用
int[]intArray = new int[1024];
intArray = ByteBuffer.wrap(arrayOfByte).asIntBuffer().array()
,但得到如下例外:
04-24 11:32:34.750: E/AndroidRuntime(4927): FATAL EXCEPTION: Thread-10
04-24 11:32:34.750: E/AndroidRuntime(4927): java.lang.UnsupportedOperationException
04-24 11:32:34.750: E/AndroidRuntime(4927): at java.nio.IntToByteBufferAdapter.protectedArray(IntToByteBufferAdapter.java:169)
04-24 11:32:34.750: E/AndroidRuntime(4927): at java.nio.IntBuffer.array(IntBuffer.java:109)
的http://計算器.com/a/7619111/1339473到ByteBuffer – QuokMoon 2013-04-24 06:19:27