public int countBitsEvenFaster(int x){
        // count bits of each 2-bit chunk
        x = x - ((x >> 1) & 0x55555555);
        // count bits of each 4-bit chunk
        x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
        // count bits of each 8-bit chunk
        x = x + (x >> 4);
        // mask out junk
        x &= 0xF0F0F0F;
        // add all four 8-bit chunks
        return (x * 0x01010101) >> 24;
    }
http://www.geeksforgeeks.org/count-set-bits-in-an-integer/
src/com/interview/bits/CountBits.java