public static byte [ ] ebmlEncodeLen ( long value , int length ) { byte [ ] b = new byte [ length ] ; for ( int idx = 0 ; idx < length ; idx ++ ) { // Rightmost bytes should go to end of array to preserve big-endian notation b [ length - idx - 1 ] = ( byte ) ( ( value >>> ( 8 * idx ) ) & 0xFF L ) ; } b [ 0 ] |= 0x80 >>> ( length - 1 ) ; return b ; }
Encodes unsigned integer with given length