Convert boolean to int in Java

Viewed 532886

What is the most accepted way to convert a boolean to an int in Java?

12 Answers
public static int convBool(boolean b)
{
int convBool = 0;
if(b) convBool = 1;
return convBool;
}

Then use :

convBool(aBool);
Related