public static long readVariableValueLength ( final byte [ ] array , final int offset , final boolean reverse ) { long len = 0 ; byte v ; long p = 0 ; int i = offset ; do { v = array [ i ] ; len += ( ( long ) ( v & ( byte ) 0x7f ) ) << p ; p += 7 ; if ( reverse ) { -- i ; } else { ++ i ; } } while ( ( v & ( byte ) 0x80 ) != 0 ) ; return len ; }
read a variable length integer in unsigned LEB128 format