I\'m trying to write a Java program that can take values and put them into a formula involving log base 10.
How can I calculate log10 in Java?
the below complete example may help you
public class Log10Math {
public static void main(String args[]) {
// Method returns logarithm of number argument with base ten(10);
short shortVal = 10;
byte byteVal = 1;
double doubleVal = Math.log10(byteVal);
System.out.println("Log10 Results");
System.out.println(Math.log10(1));
System.out.println(doubleVal);
System.out.println(Math.log10(shortVal));
}
}
Output
Log10 Results
0.0
0.0
1.0