Advertisement
CR7CR7

copyInto2D

Jun 13th, 2023
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. int[] src = new int[]{6, 3, 25, 19, 8, 6, 7};
  2. int numCopies = 3; // Брой копия, които искате да създадете
  3.  
  4. int[][] copies = new int[numCopies][src.length];
  5.  
  6. for (int i = 0; i < numCopies; i++) {
  7.     for (int j = 0; j < src.length; j++) {
  8.         copies[i][j] = src[j];
  9.     }
  10.     System.out.println("SRC" + (i + 1) + ": " + Arrays.toString(copies[i]));
  11. }
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement