private void merge(int left, int middle1, int middle2, int right)
		{
			int leftIndex= left;
			int rightIndex = middle2;
			int combIndex= left;
			int[] combArray= new int[array.length];
			
			// output two subarrays before merging
//			System.out.println( "merge:   " + subarray( left, middle1 ) );
//			System.out.println( "         " + subarray( middle2, right ) );
			System.out.println( "merge:   " + subarray( left, middle1 ) );
			System.out.println( "         " + subarray( middle2, right ) );

			
			while(leftIndex <= middle1 && rightIndex <= right){
				if(array[leftIndex] <= array[rightIndex]){
					combArray[combIndex++]= array[leftIndex++];
				} else{
					combArray[combIndex++]= array[rightIndex++];
					inversionCount = inversionCount + (middle1- leftIndex) + 1;
				}
			}// end while
			
			// if the left array is empty
			if(leftIndex == middle2){
				while(rightIndex <= right){
					combArray[combIndex++]= array[rightIndex++];
				}
			}else{// if the right array is empty
				while(leftIndex <= middle1){
					combArray[combIndex++]= array[leftIndex++];
				}
			}// end else
			
			// copy the array back to the original array
			for(int i=left; i<= right;i++){
				array[i] = combArray[i];
			}
			
			// print the merged array

//			System.out.println("	"+ subarray(left, right));
//			System.out.println();

			System.out.println("	"+ subarray(left, right));
			System.out.println();

		}// end method merge