I\'m learning Java, coming from C and I found an interesting difference between languages with the boolean type. In C there is no bool/ean
If you insist to use int instead of boolean, just use a method to convert
class BooleanHelper
{
public static boolean toBoolean (int pVal) {
return pVal != 0;
}
...
}
// apply
if (BooleanHelper.toBoolean(i)) { // BooleanHelper could be avoided using static imports...
However, just use
if (i != 0) {
is still shorter and clearer.