I have a 2D array and I just need to copy the first row into another array of the same size. What is the best way of doing this? I tried this:
public static int[][] buildCME(int[][] array){ int [][] arrayCME = new int[array.length][array[0].length]; for(int y = 1; y < array.length; y++) { for (int x = 0; x < 1; x++) { arrayCME[y][x] = array[y][x]; } } However that is just giving me 0's for the first row, which I assume has to do with my int initialization. I created this for loop because I thought it would be easier to account for than to create an if statement in a normal for loop to account for the whole 2D array. Thanks for the help!