Why does my mergesort algorithm not work? : here's my code for a mergesort in java:

    public class MergeSort {
	
	public static void mergesort(int[] input) {
		
		int inputSize = input.length;
		if(inputSize < 2) {
			return;
		}
		int[] left = new int[inputSize/2];
		int[] right = new int[inputSize/2];
		int count = 0;
		for(int i=0; i < inputSize/2; i++) {
			left[i] = input[i];
		}
		for(int i=inputSize/2; i<inputSize; i++) {
			right[count] = input[i];
			count++;
		}
		
		mergesort(left);
		mergesort(right);
		merge(left, right, input);
		
	}
	
	public static int[] merge(int[] returnArr, int[] left, int[] right) {
		int leftSize = left.length;
		int rightSize = right.length;
		int i = 0;
		int j =0;
		int k = 0;
		int count = 0;
		while(i < leftSize && j < rightSize) {
			if(left[i] <= right[j]) {
				returnArr[k] = left[i];
				i++;
			}
			else {
				returnArr[k] = right[j];
				j++;
			}
			k++;
		}
		
		while(i<leftSize) {
			returnArr[k] = left[i];
			i++;
			k++;
		}
		while(j < rightSize) {
			returnArr[k] = right[j];
			j++;
			k++;
		}
		
		for(int x=0; x<returnArr.length; x++) {
			System.out.print(returnArr[x]);
		}
		
		return returnArr;
	}
	public static void main(String[] args) {
		int[] array = {3,4,6,2,7,1,8,6};
		mergesort(array);

	}

    }

My issue is that I'm getting an out of bounds exception. I'm using the debugger and have found that after mergesort(left) and mergesort(right) have finished recursively running, the arrays left and right, which go into the merge function, have the values [3] and [4] respectively, which is correct. But when the debugger jumps into the merge function, left has value [3] and right, for some reason is length 2 and has the value [3,4]. This is the source of my out of bounds exception, though I'm not sure why when the merge function runs for its first time, it changes the value of "right". 
