Array merge --Java native method

Ado, directly on the code (Tools):

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;
}

Guess you like

Origin www.cnblogs.com/javamjh/p/12177858.html