public long allocate(int length){
  int blocks=getBlockCount(length);
  for (int i=0; ; ) {
    int start=set.nextClearBit(i);
    int end=set.nextSetBit(start + 1);
    if (end < 0 || end - start >= blocks) {
      set.set(start,start + blocks);
      return getPos(start);
    }
    i=end;
  }
}

public long allocate ( int length ) { int blocks = getBlockCount ( length ) ; for ( int i = 0 ; ; ) { int start = set . nextClearBit ( i ) ; int end = set . nextSetBit ( start + 1 ) ; if ( end < 0 || end - start >= blocks ) { set . set ( start , start + blocks ) ; return getPos ( start ) ; } i = end ; } }
allocate a number of blocks and mark them as used .
