how to convert a boolean to int in java code example Example: convert boolean to int int val = (bool) ? 1 : 0;