代码库
我如何构建一个2D代码来匹配给定的模式?
例如:
import java.util.*;
public class arrays {
public static void main(String []args){
int dim_x = 4;
int dim_y = 4;
int[][] code = new int[dim_y][dim_x * 2];
int value = 7;
for (int fy = 0; fy < dim_y; fy++) {
for (int fx = 0; fx < dim_x; fx++) {
code[fy][fx * 2] = value++;
code[fy][fx * 2 + 1] = value++;
value += 2;
}
}
System.out.println(Arrays.deepToString(code));
}
}