我试图在 Eclipse 中向控制台打印一个大的双矩阵(250x250)。该代码适用于较小的矩阵,但对于 250x250,它只打印最后 50 行左右。我究竟做错了什么 ?有一些无限元素被转换为字符串“Inf”,但在我的测试中,这对输出没有任何影响。
for (int x = 0; x < matrix.length; x++) {
for (int y = 0; y < matrix.length; y++) {
if (matrix[x][y] == Double.POSITIVE_INFINITY) {
System.out.print(" " + "Inf" + " ");
} else {
System.out.print(" " + matrix[x][y] + " ");
}
}
System.out.println();
}