public static void serialize(OutputStream out, BloomFilter bloomFilter) throws IOException {
    /**
     * Serialized BloomFilter format:
     * 1 byte for the number of hash functions.
     * 1 big endian int(That is how OutputStream works) for the number of longs in the bitset
     * big endian longs in the BloomFilter bitset
     */
    DataOutputStream dataOutputStream = new DataOutputStream(out);
    dataOutputStream.writeByte(bloomFilter.numHashFunctions);
    dataOutputStream.writeInt(bloomFilter.getBitSet().length);
    for (long value : bloomFilter.getBitSet()) {
      dataOutputStream.writeLong(value);
    }
  }
Serialize a bloom filter
@param out output stream to write to
@param bloomFilter BloomFilter that needs to be seralized
storage-api/src/java/org/apache/hive/common/util/BloomFilter.java