public static boolean judgeSquareSum(int c) {
for (int i=0;i<=Math.sqrt(c);i++)
if (Math.floor(Math.sqrt(ci*i)) == Math.sqrt(ci*i)) return true;
return false;
}
Java 3Liner

In the 3rd line, you're doing floating point comparison which might not be sufficient due to rounding errors. Is your idea based on some fact that the difference between
Math.floor(Math.sqrt(ci*i))
andMath.sqrt(ci*i)
won't be greater than a certain number? Can you provide explanation? IMO comparing integers is safer and more intuitive.for (int i=0;i<=Math.sqrt(c);i++) { int j = (int)Math.sqrt(ci*i); if (j*j == ci*i) return true; } return false;