All possible numbers of N digits and base B without leading zeros | Java implementation of the approach ; function to count all permutations ; count of all permutations ; count of permutations with leading zeros ; Return the permutations without leading zeros ; Driver code
class GFG { static void countPermutations ( int N , int B ) { int x = ( int ) Math . pow ( B , N ) ; int y = ( int ) Math . pow ( B , N - 1 ) ; System . out . println ( x - y ) ; } public static void main ( String [ ] args ) { int N = 6 ; int B = 4 ; countPermutations ( N , B ) ; } }