简体   繁体   English

Java中的大型2D双数组

[英]Large 2D double array in Java

I try to initialize 2D double array in java, this double array has 1000 rows and 50 cols. 我尝试在Java中初始化2D双数组,该双数组有1000行和50个列。

when I did that I got this error: 当我这样做的时候,我得到了这个错误:

 Too many constants, the constant pool for ClassName would exceed to 65536 entries.

The following is part of my work: 以下是我工作的一部分:

   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, ... }};

Any suggestion please? 有什么建议吗?

The constant pool allows maximum of 65536 entries and hence you can not exceed the limit . 常量池最多允许65536个条目,因此您不能超过限制

The constant pool table is where most of the literal constant values are stored. 常量池表是存储大多数文字常量值的位置。 This includes values such as numbers of all sorts, strings, identifier names, references to classes and methods, and type descriptors. 这包括诸如各种数字,字符串,标识符名称,对类和方法的引用以及类型描述符之类的值。 All indexes, or references, to specific constants in the constant pool table are given by 16-bit (type u2) numbers, where index value 1 refers to the first constant in the table (index value 0 is invalid). 常数池表中所有对特定常数的索引或引用均由16位(u2型)数字给出,其中索引值1表示表中的第一个常数(索引值0无效)。

Due to historic choices made during the file format development, the number of constants in the constant pool table is not actually the same as the constant pool count which precedes the table. 由于在文件格式开发过程中做出了历史性选择,因此常量池表中的常量数实际上与该表之前的常量池计数不同。 First, the table is indexed starting at 1 (rather than 0), so the count should actually be interpreted as the maximum index. 首先,该表从1(而不是0)开始索引,因此该计数实际上应解释为最大索引。 Additionally, two types of constants (longs and doubles) take up two consecutive slots in the table, although the second such slot is a phantom index that is never directly used. 此外,两种常量(长整型和双精度型)占用了表中的两个连续插槽,尽管第二个此类插槽是幻像索引,从未直接使用过。

The type of each item (constant) in the constant pool is identified by an initial byte tag. 常量池中每个项目(常量)的类型由初始字节标记标识。 The number of bytes following this tag and their interpretation are then dependent upon the tag value. 然后,此标签后面的字节数及其解释取决于标签值。

For more details visit here . 有关更多详细信息,请访问此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM