2009-01-12, 05:59 PM
KajitiSouls Wrote:oic. That's why I didn't understand the code itself. Java doesn't recognize integers or bytes as bit-wise for anything except XOR or char types, and is one of the gh3y things about Java. Strong type ftl. . Also, shouldn't there be a notation denoting that the 1 is a base-2 number? Such as hex number 0xAF.
Really?
Code:
public class Test{
public static void main(String args[]){
for (long i = 0; i < 11; i++)
System.out.println(i & 1);
}
}Should deliver a repeating 0-1-0-1-0... pattern. I just tested it.
There's no base-2 number in Java. It doesn't really matter, as all numbers in whatever base (as long as it is integer-based bases) will have 1 as 1 in all bases. Besides, even if I converted it to a base-2 number, it wouldn't matter much. Take for example 0xAF:
System.out.println(0xAF);
That returns 175. Now, if you replace all 0xAF to 175, your code will run as nothing happened (As long you haven't used 0xAF in regex or strings, that is.).

