Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Algorithm writing tips?
#10
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.).
Reply


Messages In This Thread
Algorithm writing tips? - by KajitiSouls - 2009-01-11, 10:40 PM
Algorithm writing tips? - by Stereo - 2009-01-11, 10:58 PM
Algorithm writing tips? - by KajitiSouls - 2009-01-11, 11:36 PM
Algorithm writing tips? - by Nikkey - 2009-01-12, 09:58 AM
Algorithm writing tips? - by Stereo - 2009-01-12, 11:52 AM
Algorithm writing tips? - by KajitiSouls - 2009-01-12, 03:53 PM
Algorithm writing tips? - by Nikkey - 2009-01-12, 04:19 PM
Algorithm writing tips? - by Stereo - 2009-01-12, 04:50 PM
Algorithm writing tips? - by KajitiSouls - 2009-01-12, 05:25 PM
Algorithm writing tips? - by Nikkey - 2009-01-12, 05:59 PM
Algorithm writing tips? - by GummyBear - 2009-01-12, 08:13 PM
Algorithm writing tips? - by KajitiSouls - 2009-01-12, 10:26 PM
Algorithm writing tips? - by Nikkey - 2009-01-13, 10:28 AM
Algorithm writing tips? - by GummyBear - 2009-01-13, 11:41 PM
Algorithm writing tips? - by Stereo - 2009-01-15, 10:38 AM
Algorithm writing tips? - by Nikkey - 2009-01-15, 11:02 AM
Algorithm writing tips? - by Kiley - 2009-01-16, 02:37 AM
Algorithm writing tips? - by KajitiSouls - 2009-01-18, 01:48 AM
Algorithm writing tips? - by Stereo - 2009-01-18, 04:46 PM
Algorithm writing tips? - by KajitiSouls - 2009-01-18, 05:37 PM
Algorithm writing tips? - by Nikkey - 2009-01-18, 06:26 PM
Algorithm writing tips? - by Stereo - 2009-01-18, 08:02 PM
Algorithm writing tips? - by KajitiSouls - 2009-01-18, 08:29 PM
Algorithm writing tips? - by Stereo - 2009-01-18, 10:45 PM
Algorithm writing tips? - by Nikkey - 2009-01-19, 02:10 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)