public static <T extends Comparable<? super T>> T[] merge(T[] ls, T[] hs,
			T[] t) {
		int i = 0;
		int j = 0;
		int pos = 0;
		while (i < ls.length && j < hs.length) {
			if (ls[i].compareTo(hs[j]) <= 0) {
				t[pos] = ls[i];
				i++;
			} else {
				t[pos] = hs[j];
				j++;
			}
			pos++;
		}

		if (i == ls.length && j < hs.length) {

			for (; j < hs.length; j++) {
				t[pos++] = hs[j];
			}
		} else {
			for (; i < ls.length; i++) {
				t[pos++] = ls[i];
			}
		}

		return t;
	}