widthInBits : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

widthInBits
Here are two implementations of a method to calculate the width of a number in bits, sort of the inverse of calculating 2 ** n. There were eight submissions. I have retained the slowest a method that uses Math.log and the fastest (19 times faster) that uses a fully unraveled binary search.

This page is posted
on the web at:

http://mindprod.com/jgloss/widthinbits.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\widthinbits.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.149.255.50]
You are visitor number