In java Math class, log10 method is used to get the base 10 logarithm of a double value.
/**
* @author lautturi.com
* Java example: get the 10-based logarithm of a number
*/
import java.util.*;
public class Lautturi {
public static void main(String[] args) {
System.out.println(Math.log10(-3));
System.out.println(Math.log10(2));
System.out.println(Math.log10(0));
System.out.println(Math.log10(3.14));
System.out.println(Math.log10(1));
}
}Source:www.lautturi.comoutput:
NaN 0.3010299956639812 -Infinity 0.49692964807321494 0.0