Here is an example:
class Logaritmos {
    public static void main(String[] args) {
        System.out.println(log(2, 128));
        System.out.println(log(5, 625));
        System.out.println(log(100, 1000));
        System.out.println(log(7, 49));
    }
    public static double log(double base, double valor) {
        return Math.log(valor) / Math.log(base);
    }
}
The method log is what you want and feel free to copy and paste into your application. The method main test. Below is the correct and expected output:
7.0
4.0
1.4999999999999998
2.0
Just note that this 1.4999999999999998 was meant to be 1.5, but when working with double there are always details regarding the accuracy.
Go here running in the ideone.
							
							
						 
When you say "base" you mean the base of the logarithm, right?
– Jéf Bueno
Would that be something like that? Math.log10(30)/Math.log(2)
– Marcondes
@LINQ that’s right LINQ, I mean the basis of the logarithm.
– CloudAC
@Marcondes tried to do this, but it didn’t work. He keeps giving a wrong answer to the calculations I’m doing.
– CloudAC
@Marcondes almost what you said
– Jefferson Quesado