Archive Monthly Archives: October 2017

Power of two check, Stream gotcha

October 1, 2017

Recently I came across a rather simple and innocent looking question which highlighted an issue you might run into when using Streams. The question was: how could you decide if a number is a power of two? If you are interested only in the possible issue, jump to the gotcha. Possible solutions Division by two […]