widthInBits : Java Glossary


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:


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

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.

Your face IP:[]
You are visitor number