c++ to java conversion, a few questions
<p>I am converting a some C++ to java and have a small bit that I am unsure about
first question is what is tested for in the line </p>

<pre><code>if (ampconst[i][0] || ampconst[i][1])
</code></pre>

<p>this in an example to the data in the array.</p>

<pre><code> static short ampconst[NUT_SERIES][2] = {
{0,0},
{0,0},
{46,-24}
};
</code></pre>

<p>and my second question is that the ampsecul array is far shorter than NUT_SERIES
so I am getting array out of bounds exceptions, the array terminates like so</p>

<pre><code>static long ampsecul[][5] = {
{0  ,-171996 ,-1742 ,92025 ,89},
{1  ,2062    ,2     ,-895  ,5},
{8  ,-13187  ,-16   ,5736  ,-31},
{9  ,1426    ,-34   ,54    ,-1},
{10 ,-517    ,12    ,224   ,-6},
{11 ,217     ,-5    ,-95   ,3},
{12 ,129     ,1     ,-70   ,0},
{15 ,17      ,-1    ,0     ,0},
{17 ,-16     ,1     ,7     ,0},
{30 ,-2274   ,-2    ,977   ,-5},
{31 ,712     ,1     ,-7    ,0},
{32 ,-386    ,-4    ,200   ,0},
{33 ,-301    ,0     ,129   ,-1},
{37 ,63      ,1     ,-33   ,0},
{38 ,-58     ,-1    ,32    ,0},
/* termination */  { -1, }
};
</code></pre>

<p>so how could this be handled in java and what would the values be at these lines
when the array is out of bounds or how would C++ handle this.</p>

<pre><code>ampsin = ampsecul[isecul][1] + ampsecul[isecul][2] * T10;
ampcos = ampsecul[isecul][3] + ampsecul[isecul][4] * T10;
</code></pre>

<p>thanks in advance for any advice.
This is the whole for loop too see the code in context.</p>

<pre><code>for (i = isecul = 0; i &lt; NUT_SERIES ; ++i) {
    double arg = 0., ampsin, ampcos;
    short j;

    if (ampconst[i][0] || ampconst[i][1]) {
    /* take non-secular terms from simple array */
    ampsin = ampconst[i][0];
    ampcos = ampconst[i][1];
    } else {
    /* secular terms from different array */
    ampsin = ampsecul[isecul][1] + ampsecul[isecul][2] * T10;
    ampcos = ampsecul[isecul][3] + ampsecul[isecul][4] * T10;
    ++isecul;
    }

    for (j = 0; j &lt; 5; ++j)
    arg += delcache[j][NUT_MAXMUL + multarg[i][j]];

    if (fabs(ampsin) &gt;= prec)
    lastdpsi += ampsin * sin(arg);

    if (fabs(ampcos) &gt;= prec)
    lastdeps += ampcos * cos(arg);
}
</code></pre>
