我有arraylist
ArrayList <double[][]>deltaedge=new ArrayList<double [][]>();
包含2个2d双数据类型数组我必须从数组no 1中减去假设数组no 0并再次将结果存储在数组no 0中。
答案 0 :(得分:-1)
double[][] one=deltaedge.get(0);
double[][] two=deltaedge.get(1);
double[][] three=Subtraction(one,two);//call this method
deltaedge.set(0, three);// set the result to zero position
// subtract method
public double[][] Subtraction(double[][] one, double[][] two) {
double[][] C = new double[one.length][one.length];
for (int r = 0; r < 2; r++) {
for (int c = 0; c < 2; c++) {
C[r][c] = one[r][c] - two[r][c];
}
}
return C;
}