Solution to find next smallest and largest int with same number of 1 bits