Perform Log Base 2 Transformation in Java
Java has functionality built into it to transform a number using the natural logarithm. This can be done using the java.util.Math.log() method. However, to my knowledge there is no way to do this for base-2 logarithms.
Please don’t let me get started on how silly this is!!
To do a base-2 log transformation:
public static double Log2(double number) { return Math.log(number)/Math.log(2); }