public int deser ( byte [ ] bytes , int start ) throws IOException { int idx = 0 ; byte current ; do { current = bytes [ start + idx ] ; ensureSpace ( idx + 1 ) ; // The last bit must be clear bits [ idx ] = ( byte ) ( current & ~ 1 ) ; idx ++ ; } while ( ( current & 1 ) != 0 ) ; // clear the remaining bytes. for ( int i = idx ; i < bits . length ; i ++ ) { bits [ i ] = 0 ; } return idx ; }
Deserialize a BitField serialized from a byte array . Return the number of bytes consumed .