News for hackers. Stuff that matters.
Re:Two's complement – You beauty by xxs on Wednesday January 11, 2017 @06:09AM (#13373141)
I think it's =much= easier to read compared to the one in the article. Although the usual approach is bit shifting the input and checking only the lowest/highest bit. Here is an example in Java:

  static void bin(int n) {		
    for (int i=0; i<32;  i++, n<<=1) System.out.print(n<0 ? '1': '0');		
  }

There are no comments on this comment yet.