How can I access a byte array as shorts in Java

Posted by shellback3 on Stack Overflow See other posts from Stack Overflow or by shellback3
Published on 2010-03-23T00:11:21Z Indexed on 2010/03/23 0:31 UTC
Read the original article Hit count: 290

Filed under:
|
|

I have a an array of byte, size n, that really represents an array of short of size n/2. Before I write the array to a disk file I need to adjust the values by adding bias values stored in another array of short. In C++ I would just assign the address of the byte array to a pointer for a short array with a cast to short and use pointer arithmetic or use a union.

How may this be done in Java - I'm very new to Java BTW.

© Stack Overflow or respective owner

Related posts about java

Related posts about bytearray