i’m converting a c++ header to java and the following does not work.
opstring is a string and alumacOP is a string array. opindex is an int.
opstring = alumacOP[opindex][(op >> 11) & 3 == 3]; //code does not work.
this does not work for some reason. it’s not the algorithm, but eclipse saying that ‘&’ is not defined for types boolean and int.
so my question is: Why does logical AND reference only Boolean values in java? because this works:
boolean boola,boolb;
if(boola & boolb)
return;
but not this (eclipse still throws an error:
int x = 9, y = 8;
for(int i = 0; i < 100; i++)
if(x & y = i)
return;
It depends on operator precedence.
is what you want. (note the parenthesis around &, and the ?: to convert bool to int.