0
我嘗試在java中初始化2D雙列數組,這個雙列數組有1000行和50列。Java中的大型2D雙列數組
當我這樣做,我得到這個錯誤:
Too many constants, the constant pool for ClassName would exceed to 65536 entries.
以下是我工作的一部分:
double[][] haltonArray = {{0.116538, -1.08275, -0.832512, 1.9746, 1.68741, 2.23391,
0.703111, -0.400975, -1.8214, -2.22141, 0.127014, -1.31939,
0.874426, 0.0916673, 0.236509, 0.731912, 1.43766, 0.88484,
1.13653, -0.882871, -0.212072, -0.431315, -1.21639, -0.0352919,
0.334481, 0.891777, -0.178983, 0.531624, -0.360295, 0.551329,
0.696159, -0.595714, 0.27043, -0.262656, -0.176079, -0.667502,
0.66105, -0.593195, 2.10675,
0.168339, -0.918746, -1.59296, -0.0584028, -0.336773, -1.0043,
-1.59346, -0.041084, 1.93094, 0.896973,0.637633},
{-0.534821, -0.0682488, -0.246726, -1.08433, -1.61264,
-1.47508, 0.907127, -0.261507, -1.42036, -1.66814, 0.209045, -1.17226,
0.967877, 0.150398, 0.291741, 0.795219, 1.56906, 0.947359,
1.21103, -0.831883, -0.177076, -0.396745, -1.15539, -0.00712026,
0.361938, 0.929345, -0.154306, 0.558805, -0.335862, 0.577341,
0.721534, -0.573016, 0.289458, -0.244034, -0.159018, -0.6469,
0.681047, -0.574957, 2.27073,
0.183053, -0.897595, -1.54553, -0.0452613, -0.323059, -0.983445,
-1.55014, -0.0291968, 2.00915, 0.913608, 0.651105}, {0.828784, ... }};
任何建議嗎?
我認爲這是重複http://stackoverflow.com/questions/11437905/java-too-many-constants-jvm-error – 2013-04-23 10:26:23
您可以將這些常量存儲在一個文件中,並在應用程序啓動時讀取該文件。 – 2013-04-23 10:27:44
你只是在你的課堂上有這個代碼嗎? – Freak 2013-04-23 10:29:56