I don’t know what I’m doing wrong here - I’m trying to copy part of a boolean array into another, but it’s completely not working - i’m not getting the expected results from this basic test - the source array has a mixture of true and false values - but when i print out the tempbits destination array - it’s either all true or all false, depending on the order in which i done the testing…
[java]
tempMatbits = new boolean[mx][maxHeight][mx];
for (int h = 0; h < maxHeight; h++) {
if (nodesMatbits[xkey][hkey][ykey].matBits[x][h][y] == false);
{
tempMatbits[x][h][y] = false;
}
if (nodesMatbits[xkey][hkey][ykey].matBits[x][h][y] == true);
{
tempMatbits[x][h][y] = true;
}
}
[/java]
Remove ; from behind the if statements.
Nice one, took me a moment to notice
Anyway it is a lot easier to just write
tempMatbits[x][h][y] = nodesMatbits[xkey][hkey][ykey].matBits[x][h][y]
instead of that two if statements.
aaaaaaaaaaaa yes!
that one has caught me out before a few times!
when you’re tired and staring at a screen all day it’s easy to miss a tiny semi colon,
thank you eagle eyes
Small advice : use Findbugs if you can. It will detect a lots of common mistakes such as that one.
http://findbugs.sourceforge.net/
thanks looks useful!