rendered paste bodypublic class t3x2 {
public static void main(String[] args) {
int hloc = 0;
int tohash = 0;
int modulo = 23;
int count = 0;
int[] hash = new int[23]; // values come here, initialized to zero
for (int i = 0; i < args.length; i++)
{
tohash = (Integer.parseInt(args[i])) + 2;
hloc = tohash % modulo;
if (hash[hloc] != 0)
{
do
{
count++;
hloc = (tohash + (count * count)) % modulo;
} while (count <= modulo && hash[hloc] != 0);
}
count = 0;
hash[hloc] = tohash - 2;
}
for (int i = 0; i < hash.length; i++)
{
System.out.printf(" %3d: %3d\n", i, hash[i]);
}
} // main
} // class