public static byte [ ] intArrayToBytes ( Collection < Integer > values ) { ByteBuffer buffer = ByteBuffer . allocate ( values . size ( ) * Integer . BYTES ) ; for ( int value : values ) { buffer . putInt ( value ) ; } return buffer . array ( ) ; }
Pack an array of ints as big endian .