Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Finding if a number is a power of 2 or not in Java?

How to find whether a Number is a power of 2 or not in Java?There can be many possible solutions to this problem, but probably the most efficient remains to be the one which uses bit-level manipulation wisely.We'll talk about only that solution here and since it involves bit-level manipulation of binary sequences, so should you require a refresh, first go through this article - 2's complement, 1'



This post first appeared on Geek Explains: Java, J2EE, Oracle, Puzzles, And Problem Solving!, please read the originial post: here

Share the post

Finding if a number is a power of 2 or not in Java?

×

Subscribe to Geek Explains: Java, J2ee, Oracle, Puzzles, And Problem Solving!

Get updates delivered right to your inbox!

Thank you for your subscription

×