I'm wondering if there's a way to convert a boolean to an int without using if statements (as not to break the pipeline). For example, I could write
int boolToInt( boolean b ){
  if ( b )
    return 1
  return 0
But I'm wondering if there's a way to do it without the if statement, like Python's
bool = True 
num = 1 * ( bool )
I also figure you could do
boolean bool = True;
int myint = Boolean.valueOf( bool ).compareTo( false );
This creates an extra object, though, so it's really wasteful and I found it to be even slower than the if-statement way (which isn't necessarily inefficient, just has the one weakness).
 
     
     
     
     
     
     
     
     
     
     
     
     
     
    