private static void mergeArrays(int[] x, int[] l, int[] r){
		int total = l.length + r.length;
		int li = 0, ri = 0, i = 0;
		while(i < total){ //For the number of elements present
			if(li < l.length && ri < r.length){
				comps++;
				moves++;
				if(l[li] < r[ri]){ //If left value is smaller, move it into place
					x[i++] = l[li++];
				}else{ //Otherwise, move the right value into place
					x[i++] = r[ri++];
				}
			}else{
				if(li >= l.length){ //If we have used up all the left values, move the rest of the right values into place
					while(ri < r.length){
						moves++;
						x[i++] = r[ri++];
					}
				}
				if(ri >= r.length){ //If we have used up all the right values, move the rest of the left values into place
					while(li < l.length){
						moves++;
						x[i++] = l[li++];
					}
				}
			}
		}
	}