因此我必须编写一个方法进入数组,并从i行到j行,并将这些行复制到一个新数组。这是我到目前为止所提供的从一个二维数组拷贝特定的行到另一个没有system.arraycopy
public static void getRows(int i, int j, int[][] array){
int another[] = new int[j-i];
int n = 0;
for (int k = 0; k < array.length; k++){
while (i <= j){
if (k == i){
another[n] = array[k][0];
}
i++;
}
}
}
问题是? – shmosel
['Arrays.copyOf'](https://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#copyOf(boolean [],%20int))? –
如何做到这一点。这段代码不起作用 –