remember that the hash function calculates the location of given data item based on the array sizeso items won' be located in the same place in the large array as they were in the small array you can' therefore simply copy the items from one array to the other you'll need to go through the old array in sequencecell by cellinserting each item you find into the new array with the insert(method this is called rehashing it' time-consuming processbut necessary if the array is to be expanded the expanded array is usually made twice the size of the original array actuallybecause the array size should be prime numberthe new array will need to be bit more than twice as big calculating the new array size is part of the rehashing process here are some routines to help find the new array size (or the original array sizeif you don' trust the user to pick prime numberwhich is usually the caseyou start off with the specified size and then look for the next prime larger than that the getprime(method gets the next prime larger than its argument it calls isprime(to check each of the numbers above the specified size private int getprime(int min/returns st prime min for(int min+ truej++/for all min ifisprime( /is primereturn /yesreturn it /private boolean isprime(int /is primefor(int = ( * < ) ++/for all ifn = /divides evenly by jreturn false/yesso not prime return true/noso prime these routines are not the ultimate in sophistication for examplein getprime(you could check and then odd numbers from then oninstead of every number howeversuch refinements don' matter much because you usually find prime after checking only few numbers java offers class vector that is an array-like data structure that can be expanded howeverit' not much help because of the need to rehash all data items when the table changes size