Matrix arrays Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Matrix arrays Java

Hi. Supposing I have a 2 x 3 matrix with only 1 or 0 in the positions, and in each position we want to print another 2 x 2 matrix of the same characteristics; resulting in a new 4 x 6 matrix; how can I assign the value of the first matrix to each position of the final one? Example 010 ———-> 001100 001100 010 001100 001100

6th Sep 2019, 7:48 PM
Alejo Garat
Alejo Garat - avatar
3 Answers
+ 1
copy first to second, but in second add each value twice and at the end of row duplicate last row
7th Sep 2019, 5:11 AM
zemiak
0
and how can I “compare” the two arrays without using for for for for? Is there any way to do it without having the second one in the same bucle?
7th Sep 2019, 4:58 PM
Alejo Garat
Alejo Garat - avatar
0
if your matrix has target size, you can copy 0,1 -> 0,3| 1,3 1,1 -> 2,3| 3,3 ... at the end make copy of each new row and fill empty lines
7th Sep 2019, 9:13 PM
zemiak