public byte [ ] toBytesSparse ( int nonEmptyBuckets ) { int size = SERDE_HEADER_SIZE + getSparseStorageSize ( nonEmptyBuckets ) ; ByteBuffer buf = ByteBuffer . allocate ( size ) ; writeByteBufferSparse ( buf , nonEmptyBuckets ) ; return buf . array ( ) ; }
Serialize the histogram in sparse encoding mode .