Utils¶
murmur2¶
int murmur2(
byte[] data)
murmur2
generates a 32-bit murmur2 hash for the given byte array.
murmur2
is used when:
DefaultPartitioner
is requested to compute a partition for a record
Demo¶
import org.apache.kafka.common.utils.Utils
val keyBytes = "hello".getBytes
val hash = Utils.murmur2(keyBytes)
println(hash)
toPositive¶
int toPositive(
int number)
toPositive
converts a number to a positive value.