I was wondering why Java doesn\'t allow casting from a boolean to an int, like so:
boolean foo = true; int bar = (int)foo;
This can be done
Java supports widening conversions on primitive numeric types. However, boolean is not considered a numeric type.
The supported widening conversions are listed under "Widening Primitive Conversion" in the Java Language Specification.