public void Merge(int low, int mid, int high) throws InterruptedException{
		int[] sortedArray = new int[values.length];
		//copy both parts into a temporary array
		for(int i=low; i <= high; i++){
			sortedArray[i] = values[i];
		}
		int i = low;
		int j = mid + 1;
		int k = low;
				
		// copy the smallest values from either the left or the right side back
	    // to the original array
		while( i<=mid && j <= high){
			sortStateLock.lock();
			try{
			   if(sortedArray[i] <= sortedArray[j]){
			       values[k] = sortedArray[i];
				   markedPos = i;
				   i++;
				}
				else {
				   values[k] = sortedArray[j];
				   markedPos = j;
				   j++;
				}		
			}
			finally{
				sortStateLock.unlock();
			}
			pause(5);
			k++;
		}
				
		// copy the rest of the left side of the array into the target array
		while(i <= mid){
		   values[k] = sortedArray[i];
		   k++; i++;
				
		}
	}