SyntaxFix
Write A Post
Hire A Developer
Questions
If you use Apache Commons Lang (which I think a lot of projects use it), you can just use it like this:
int myInt = BooleanUtils.toInteger(boolean_expression);
toInteger method returns 1 if boolean_expression is true, 0 otherwise
toInteger
boolean_expression