Find the Largest N digit perfect square number in Base B | Java implementation to find largest N digit perfect square number in base B ; Function to find the largest N digit number ; Largest n - digit perfect square ; Print the result ; Driver code
import java . io . * ; import java . util . * ; class GFG { static double nDigitPerfectSquares ( int n , int b ) { double largest = Math . pow ( Math . ceil ( Math . sqrt ( Math . pow ( b , n ) ) ) - 1 , 2 ) ; return largest ; } public static void main ( String [ ] args ) { int N = 1 , B = 8 ; System . out . println ( nDigitPerfectSquares ( N , B ) ) ; } }