static public int unpackInt ( ByteBuffer bb ) throws IOException { for ( int offset = 0 , result = 0 ; offset < 32 ; offset += 7 ) { int b = bb . get ( ) & 0xffff ; result |= ( b & 0x7F ) << offset ; if ( ( b & 0x80 ) == 0 ) { return result ; } } throw new Error ( "Malformed integer." ) ; }
Unpack positive int value from the input byte buffer .