protected static Object[] concatenate(Object[] a1,Object[] a2){
  int a1Len=a1.length;
  int a2Len=a2.length;
  if (a1Len == 0)   return a2;
  if (a2Len == 0)   return a1;
  Object[] res=new Object[a1Len + a2Len];
  System.arraycopy(a1,0,res,0,a1Len);
  System.arraycopy(a2,0,res,a1Len,a2Len);
  return res;
}

protected static Object [ ] concatenate ( Object [ ] a1 , Object [ ] a2 ) { int a1Len = a1 . length ; int a2Len = a2 . length ; if ( a1Len == 0 ) return a2 ; if ( a2Len == 0 ) return a1 ; Object [ ] res = new Object [ a1Len + a2Len ] ; System . arraycopy ( a1 , 0 , res , 0 , a1Len ) ; System . arraycopy ( a2 , 0 , res , a1Len , a2Len ) ; return res ; }
utility method to concatenate two arrays .
