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
); }
}
Y2xhc3MgTG9nYXJpdG1vcyB7CgogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihsb2coMiwgMTI4KSk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGxvZyg1LCA2MjUpKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4obG9nKDEwMCwgMTAwMCkpOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihsb2coNywgNDkpKTsKICAgIH0KCiAgICBwdWJsaWMgc3RhdGljIGRvdWJsZSBsb2coZG91YmxlIGJhc2UsIGRvdWJsZSB2YWxvcikgewogICAgICAgIHJldHVybiBNYXRoLmxvZyh2YWxvcikgLyBNYXRoLmxvZyhiYXNlKTsKICAgIH0KfQ==