Program to compute log a to any base b ( logb a ) | Java program to find log ( a ) on any base b ; Driver code
class GFG { static int log_a_to_base_b ( int a , int b ) { return ( int ) ( Math . log ( a ) / Math . log ( b ) ) ; } public static void main ( String [ ] args ) { int a = 3 ; int b = 2 ; System . out . println ( log_a_to_base_b ( a , b ) ) ; a = 256 ; b = 4 ; System . out . println ( log_a_to_base_b ( a , b ) ) ; } }