Modulus Problem
Hi, i have had a look through the forums and i can't find anything along these lines.
Basically i am trying to generate a hash code using the modulus function but for some reason i am not getting the expected value back (or i am expecting the wrong value). Could someone tell me where im going wrong...heres the code:
public static int hash(int h) {
h = h % 20;
return h;
}
if i set h to be 2 then the returned value is 2. i was expecting 0 as there are no remainders when 20 is divided by 2. another example is when h = 6, it just returns 6 as if it isn't even running the modulus function.
Thanks, Nick

