What is the most accepted way to convert a boolean to an int in Java?
boolean
int
int myInt = myBoolean ? 1 : 0;
^^
PS : true = 1 and false = 0
2.1m questions
2.1m answers
60 comments
57.0k users