listing continued string getstring()return integer parseint( )//end class heapsortapp the heap class is much the same as in the heap java program (listing )except that to save space we've removed the trickleup(and insert(methodswhich aren' necessary for heapsort we've also added an insertat(methodwhich allows direct insertion into the heap' array notice that this addition is not in the spirit of object-oriented programming the heap class interface is supposed to shield class users from the underlying implementation of the heap the underlying array should be invisiblebut insertat(allows direct access to it in this situation we accept the violation of oop principles because the array is so closely tied to the heap architecture an incrementsize(method is another addition to the heap class it might seem as though we could combine this with insertat()but when we're inserting into the array in its role as an ordered arraywe don' want to increase the heap sizeso we keep these functions separate the main(routine in the heapsortapp class does the following gets the array size from the user fills the array with random data turns the array into heap with / applications of trickledown( removes the items from the heap and writes them back at the end of the array after each step the array contents are displayed the user selects the array size here' some sample output from heapsort javaenter number of items random heap sorted