I tried to convert int to byte[] and wrote for this following:
byte[] bytes = new byte[4];
ByteBuffer buff = ByteBuffer.allocate(4);
buff.putInt(1222);
buff.get(bytes);
but as result I had java.nio.BufferOverflowException without detail message.
As for me code is valid. What is wrong? How to convert int to byte[]?