class MergeUtils {

	public static byte[] merge(List<byte[]> operands) {
		if (operands == null || operands.size() == 0) {
			return null;
		}

		if (operands.size() == 1) {
			return operands.get(0);
		}

		int numBytes = 0;
		for (byte[] arr : operands) {
			numBytes += arr.length + 1;
		}
		numBytes--;

		byte[] result = new byte[numBytes];

		System.arraycopy(operands.get(0), 0, result, 0, operands.get(0).length);

		for (int i = 1, arrIndex = operands.get(0).length; i < operands.size(); i++) {
			result[arrIndex] = DELIMITER;
			arrIndex += 1;
			System.arraycopy(operands.get(i), 0, result, arrIndex, operands.get(i).length);
			arrIndex += operands.get(i).length;
		}

		return result;
	}

}