我使用ArrayUtils.add(double[], double)
一些频率。显然我对为什么它在这里不起作用有一个盲点。任何人都可以帮忙吗?
double[] reliableNeighborValues = new double[1];
for (int j = 0; j < 8; j++) {
if (pixelInfo[j] > 0) {
System.out.println("pre add array length "+reliableNeighborValues.length);
for (int k = 0; k < reliableNeighborValues.length; k++) {
System.out.println("-- "+reliableNeighborValues[k]);
}
ArrayUtils.add(reliableNeighborValues, pixelInfo[j]);
System.out.println("reliable neighbor "+j+" "+pixelInfo[j]+" array length "+reliableNeighborValues.length);
for (int k = 0; k < reliableNeighborValues.length; k++) {
System.out.println("-- "+reliableNeighborValues[k]);
}
}
}
输出:
pre add array length 1
-- 0.0
reliable neighbor 0 5.3364882 array length 1
-- 0.0