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
You could try something like that. Boolean i = true; if (i) System.out.println("i is true");
Just initialize it as a boolean value rather than an integer.
Try BooleanUtils from Apache common-lang.
BooleanUtils.toBoolean(0) = Boolean.FALSE
BooleanUtils.toBoolean(1) = Boolean.TRUE
BooleanUtils.toBoolean(2) = Boolean.TRUE