public static byte [ ] toBytes ( int val ) { byte [ ] b = new byte [ 4 ] ; for ( int i = 3 ; i > 0 ; i -- ) { b [ i ] = ( byte ) val ; val >>>= 8 ; } b [ 0 ] = ( byte ) val ; return b ; }
Convert an int value to a byte array .