public static byte [ ] getBytes ( long val , long size ) { byte [ ] res = new byte [ ( int ) size ] ; long bv = val ; for ( int i = ( int ) size - 1 ; i >= 0 ; -- i ) { res [ i ] = ( byte ) ( bv & 0xFF ) ; bv >>= BIT_IN_BYTE ; } return res ; }
method to encode long as byte array of given size