Java Math.log10(double a)

Syntax

Math.log10(double a) has the following syntax.

public static double log10(double a)

Example

In the following code shows how to use Math.log10(double a) method.


/*from w w  w. j a  v  a  2 s. co  m*/
public class Main {

   public static void main(String[] args) {
      double x = 123456.7;
      double y = -123.45;


      // get the base 10 logarithm for x
      System.out.println("Math.log10(" + x + ")=" + Math.log10(x));

      // get the base 10 logarithm for y
      System.out.println("Math.log10(" + y + ")=" + Math.log10(y));


   }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable