You're using Bitwise AND where you should be using Logical AND.
if(47 & 64, true, false)
returns false
.
if(48 & 64, true, false)
returns false
.
if(47 && 64, true, false)
returns true
.
if(47 && 64, true, false)
returns true
.
if(0 && 64, true, false)
returns false
.
So, you don't need the > 0
and since you are returning a bool you don't need the if()
. You can replace the whole lot with the expression,
i && 64
See also, Wiki - how to post code on this forum