Is there any way to do a kind of static cast between an int[] and byte[] ?
Short answer, no.
But you could wrap the byte[] in a ByteBuffer and get anIntBuffer from it, or just use its getInt()/putInt() methods.
In many cases, this would meet your requirements, even if not exactly what you ask for.
Something like:
byte[] bytes ...;
ByteBuffer buffer = ByteBuffer.wrap(bytes); // No copy, changes are reflected
int foo = buffer.getInt(0); // get int value from buffer
foo *= 2;
buffer.putInt(0, foo); // write int value to buffer
// Or perhaps
IntBuffer intBuffer = buffer.asIntBuffer(); // Creates an int "view" (no copy)
int bar = intBuffer.get(0);
intBuffer.set(0, bar);
The byte order of the byte buffer when working with multi-byte values, like int can be controlled using:
buffer.order(ByteOrder.BIG_ENDIAN); // Default is platform specific, I believe