// highArray.java // demonstrates array class with high-level interface // to run this program: C>java HighArrayApp //////////////////////////////////////////////////////////////// class GHighArray { protected T [] a; // ref to array a protected int nElems; // number of data items //----------------------------------------------------------- public GHighArray (int max) // constructor { a = (T[]) new Object [max]; // create the array nElems = 0; // no items yet } //----------------------------------------------------------- public boolean find(T searchKey) { // find specified value int j; for(j=0; j arr; // reference to array arr = new GHighArray(maxSize); // create the array arr.insert(77L); // insert 10 items arr.insert(99L); arr.insert(44L); arr.insert(55L); arr.insert(22L); arr.insert(88L); arr.insert(11L); arr.insert(00L); arr.insert(66L); arr.insert(33L); arr.display(); // display items Long searchKey = 35L; // search for item if( arr.find(searchKey) ) System.out.println("Found " + searchKey); else System.out.println("Can't find " + searchKey); arr.delete(00L); // delete 3 items arr.delete(55L); arr.delete(99L); arr.display(); // display items again } // end main() } // end class HighArrayApp