public static void overwrite(long[] vector,long val,int offset,int len){
  int idx=offset >> 6;
  int bitIdx=offset & 63;
  int truncatedValLen=Math.min(len,64 - bitIdx);
  vector[idx]&=~(maskBelow(truncatedValLen) << bitIdx);
  vector[idx]|=val << bitIdx;
  if (len != truncatedValLen) {
    long mask=maskBelow(len - truncatedValLen);
    vector[idx + 1]&=~mask;
    vector[idx + 1]|=(val >>> truncatedValLen);
  }
}

public static void overwrite ( long [ ] vector , long val , int offset , int len ) { int idx = offset > > 6 ; int bitIdx = offset & 63 ; int truncatedValLen = Math . min ( len , 64 - bitIdx ) ; vector [ idx ] &= ~ ( maskBelow ( truncatedValLen ) << bitIdx ) ; vector [ idx ] |= val << bitIdx ; if ( len != truncatedValLen ) { long mask = maskBelow ( len - truncatedValLen ) ; vector [ idx + 1 ] &= ~ mask ; vector [ idx + 1 ] |= ( val > > > truncatedValLen ) ; } }
overwrites a bit range within the vector .
