Skip to content

Instantly share code, notes, and snippets.

@carousel
Created December 18, 2019 10:12
Show Gist options
  • Save carousel/2a051f9b649e22685e1bc0b8ac9f11f5 to your computer and use it in GitHub Desktop.
Save carousel/2a051f9b649e22685e1bc0b8ac9f11f5 to your computer and use it in GitHub Desktop.
calculate logarithm for any base in java
int num = 8;
int base = 2;
double log = Math.log(num) / Math.log(base);
System.out.println(log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment