ArrayIndexOutOfBoundsException:索引2超出长度2的范围

时间:2020-04-04 04:23:43

标签: java

我想将矩阵乘以向量:

int s = 1;

for (int j = 0; j < Matrix.coll2(); j++) {
    for (int i = 1 + j ; i <= row * so; i += so) {
        d += Matrix.nums[i] * Vector.nums[s];
        System.out.println(d);
        vec[j] += d;
        s++;
        d = 0;
    }
    s = 1;

}

但我收到此错误:

Index 2 out of bounds for length 2

0 个答案:

没有答案