private static int[] merge(int[] array1, int[] array2) {
		int[] result = new int[array1.length + array2.length];
		
		int index = 0;
		int index1 = 0;
		int index2 = 0;
		
		while(index1 < array1.length && index2 < array2.length) {
			if(array1[index1] < array2[index2]) {
				result[index] = array1[index1];
				index1++;
			} else {
				result[index] = array2[index2];
				index2++;
			}
			
			index++;
		}
		
		while(index1 < array1.length) {
			result[index++] = array1[index1++];
		}
		
		while(index2 < array2.length) {
			result[index++] = array2[index2++];
		}
		
		return result;
	}