Hi I have a large 2D array ( sample[1000][10]
). I was wondering, how can I copy over the last row (1000) into a temp 2d array ( temp[1][10]
)?
EDIT: I have tried the following but I was wondering if there is a much quicker code:
for (int i = 0; i < 10; i++){
temp[0][i] = sample[sample.length - 1][i];
}
使用System.arraycopy
:
System.arraycopy(sample[999], 0, temp[0], 0, 10);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.