Automation Tutorials
Tutorials about Automation System PLC SCADA SQL JAVA Programming Tips & Tricks
PLC
SQL Server
Windows
C# programming
Web
Android
logarithm base 2 calculation in java
By default java provides base 10 using In build Math class
Base 10 log
Math.log(input) ;
Base 2 log
Math.log(input) / Math.log(2);
This methods will return values in double so if you need integer
int zeros=(int) (Math.log(input)/ Math.log(2));
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment