compression functions the hash code for key will typically not be suitable for immediate use with bucket arraybecause the range of possible hash codes for our keys will typically exceed the range of legal indices of our bucket array that isincorrectly using hash code as an index into our bucket array may result in an array out-of-bounds exception being throwneither because the index is negative or it exceeds the ca pacity of thusonce we have determined an integer hash code for key object kthere is still the issue of mapping that integer into the range [ , this map ping is the second action that hash function performsand good compression function is one that minimizes the possible number of collisions in given set of hash codes the division method one simple compression function is the division methodwhich maps an integer to |imod nwhere nthe size of the bucket arrayis fixed positive integer additionallyif we take to be prime numberthen this compression function helps "spread outthe distribution of hashed values indeedif is not primethen there is higher likelihood that patterns in the distribution of hash codes will be repeated in the distribution of hash valuesthereby causing collisions for exampleif we insert keys with hash codes { , , , , , into bucket array of size then each hash code will collide with three others but if we use bucket array of size then there will be no collisions if hash function is chosen wellit should ensure that the probability of two different keys getting hashed to the same bucket is / choosing to be prime number is not always enough