Java calculate the logarithm of a number

Java calculate the logarithm of a number

Syntax

‮er‬fer to:lautturi.com
//the natural logarithm (base e) 
public static double log(double a);

// the base 10 logarithm
public static double log10(double a);

Example:

/**
 * @author lautturi.com
 * Java example:calculate logarithm in java
 */

import java.util.*;

public class Lautturi {

	public static void main(String[] args) {
		
		int num = 144;
		double lognum1 = Math.log(num);
		double lognum2 = Math.log10(num);
		System.out.println(lognum1);
		System.out.println(lognum2);
	}
}

output:

4.969813299576001
2.1583624920952498
Created Time:2017-09-20 12:24:43  Author:lautturi