废话不多说,直接上代码(工具类):
public static Object[] combineArray(Object one[], Object two[]) throws BussinessException
{
Object res[] = null;
if(one != null && one.length > 0 && (two == null || two.length == 0))
{
res = new Object[one.length];
System.arraycopy(one, 0, res, 0, one.length);
}
if((one == null || one.length == 0) && two != null && two.length > 0)
{
res = new Object[two.length];
System.arraycopy(two, 0, res, 0, two.length);
}
if(two != null && one != null && two.length > 0 && one.length > 0)
{
res = new Object[two.length + one.length];
System.arraycopy(two, 0, res, 0, two.length);
System.arraycopy(one, 0, res, two.length, one.length);
}
return res;
}
来源:https://www.cnblogs.com/javamjh/p/12177858.html