// When a square root is a whole number, then the number is a perfect square number
public class MyClass {
private static boolean isPerfectSquare(int number) {
double d_sqrt = Math.sqrt((double)number);
if ((int)Math.pow((int)(d_sqrt + 0.5), 2) == number)
return true;
else
return false;
}
public static void main(String args[]) {
int num = 81;
if (isPerfectSquare(num) != false) {
System.out.print(num + " is a perfect square");
}
else {
System.out.print(num + " is not a perfect square");
}
}
}
/*
run:
81 is a perfect square
*/