/** * A class with only one method used to * call an insertion sort for an array * * @author Tim Mongold * @version 1.1 */ public class Sorts { private Object[] myArray; /** * This method is the insertion sort * * @param array is the array that is sorted */ public Sorts (Object[] array) { myArray = array; sortArray(myArray); } public void sortArray(Object[] array) { double temp; System.out.println (" just entered sortArray "); for (int i = 0; i < array.length - 1; i++) { System.out.println (i); printArray(); System.out.println(); if ((Double)array[i] > (Double)array[i + 1]) { temp = (Double) array[i + 1]; array[i + 1] = array[i]; array[i] = temp; sortArray(array); } // end if } // end for }// end sortArray private void printArray() { for (int i = 0; i < myArray.length; i++) { System.out.print ((Double) myArray[i] + " " ); }// end for } //end printArray }// end class