Fixed getBitsFromNumber algorithm.