Jul
15

The Math.log() method calculates natural logarithms. If you need to use base 2 then take the natural log and divide it by ln(2)
double log2 = Math.log(x) / Math.log(2);
Leave a Reply
You must be logged in to post a comment.
Recent Comments