Possible Duplicate:
Using a bitwise & inside an if statement
I have the following piece of code from http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/
if (edgeTable[cubeindex] & 1)
vertlist[0] =
VertexInterp(isolevel,grid.p[0],grid.p[1],grid.val[0],grid.val[1]);
if (edgeTable[cubeindex] & 2)
vertlist[1] =
VertexInterp(isolevel,grid.p[1],grid.p[2],grid.val[1],grid.val[2]);
How can i rewrite the if statements so they will run in Java ?
Regards Michael
edgeTable[cubeindex] & 1is a valid operation in Java and has the same meaning as in C. You can have a look at the Java tutorial on Bitwise and Bit Shift Operators for more information.But you need to test for an explicit condition in the if statement: