Привет, конечно можно, я делал такое на проекте, вот код тебе.
//This method allows us to combine few dataProviders into one
public static Object[][] combine(Object[][] a1, Object[][] a2) {
List<Object[]> objectCodesList = new LinkedList<>();
for (Object[] o : a1) {
for (Object[] o2 : a2) {
objectCodesList.add(concatAll(o, o2));
}
}
return objectCodesList.toArray(new Object[0][0]);
}
@SafeVarargs
private static <T> T[] concatAll(T[] first, T[]... rest) {
//calculate the total length of the final object array after the concat
int totalLength = first.length;
for (T[] array : rest) {
totalLength += array.length;
}
//copy the first array to result array and then copy each array completely to result
T[] result = Arrays.copyOf(first, totalLength);
int offset = first.length;
for (T[] array : rest) {
System.arraycopy(array, 0, result, offset, array.length);
offset += array.length;
}
return result;
}