Largest N digit number in Base B | Java program for the approach ; Function to print the largest N - digit numbers of base b ; Find the largest N digit number in base b using the formula B ^ N - 1 ; Print the largest number ; Driver Code ; Given Number and Base ; Function Call
import java . util . * ; class GFG { static void findNumbers ( int n , int b ) { double largest = Math . pow ( b , n ) - 1 ; System . out . println ( largest ) ; } public static void main ( String [ ] args ) { int N = 2 , B = 5 ; findNumbers ( N , B ) ; } }