Imagine we have two arrays:
String[] arr1 = {"a", "b"};
String[] arr2 = {"1", "2", "3"};
What is the better way to get the third String array that contains multiplied values of both. Like:
String[] arr3 = {"a1", "a2", "a3", "b1", "b2", "b3"};
I know, I can use cycles and concatenate each element from 1 with each from 2 and put the result in the 3. But actually there are much more elements in the arr1
and in arr2
. Is there a special instrument in Java to make it more efficiently?