Java tutorial
//package com.java2s; /************************************************************************** * Licensed Material - Property of Dawn InfoTek * * Copyright (c) Dawn InfoTek Inc. 1999, 2004, 2008 -All rights reserved. * * (<http://www.dawninfotek.com>) * * * * This file contains proprietary intellectual property of * * Dawn InfoTek Inc. The contents of and information in this file * * is only to be used in conjunction with a valid Dawn4J license * * as specified in the Dawn4J license agreement. All other use * * is prohibited. * **************************************************************************/ public class Main { /** * Merge byte arraies. * * @param array1 the array1 * @param array2 the array2 * * @return the byte[] */ public static byte[] mergeByteArraies(byte[] array1, byte[] array2) { if (array1 == null) { return array2; } else if (array2 == null) { return array1; } else { byte[] result = new byte[array1.length + array2.length]; System.arraycopy(array1, 0, result, 0, array1.length); System.arraycopy(array2, 0, result, array1.length, array2.length); return result; } } }