public void writeToLuceneStream(IndexOutput outputStream,int k){
  if (isSparse) {
    elementalToSemantic();
  }
  long[] bitArray=bitSet.getBits();
  for (int i=0; i < k / 64; i++) {
    try {
      outputStream.writeLong(bitArray[i]);
    }
 catch (    IOException e) {
      logger.severe("Couldn't write binary vector to lucene output stream.");
      e.printStackTrace();
    }
  }
}

public void writeToLuceneStream ( IndexOutput outputStream , int k ) { if ( isSparse ) { elementalToSemantic ( ) ; } long [ ] bitArray = bitSet . getBits ( ) ; for ( int i = 0 ; i < k / 64 ; i ++ ) { try { outputStream . writeLong ( bitArray [ i ] ) ; } catch ( IOException e ) { logger . severe ( "Couldn't write binary vector to lucene output stream." ) ; e . printStackTrace ( ) ; } } }
writes vector out to object output stream . converts to dense format if necessary . truncates to length k .
