how to get logarithm in java

Solutions on MaxInterview for how to get logarithm in java by the best coders in the world

showing results for - "how to get logarithm in java"
Sofia
01 Jan 2021
1import java.lang.Math;
2int y = 69;
3double x = Math.log(y);   // this will return the log base e of a number
4
5// for log base b (anything else from e)
6double x = Math.log(y)/Math.log(b);   // this will return the log base b of a number