@Test public void testIsSquare() { assertTrue(Library.isSquare(0)); assertTrue(Library.isSquare(1)); assertTrue(Library.isSquare(4)); assertTrue(Library.isSquare(9)); assertTrue(Library.isSquare(16)); assertTrue(Library.isSquare(25)); assertTrue(Library.isSquare(36)); assertTrue(Library.isSquare(100)); assertTrue(Library.isSquare(65536)); assertTrue(Library.isSquare(2147302921)); assertTrue(Library.isSquare(2147395600)); assertFalse(Library.isSquare(Integer.MIN_VALUE)); assertFalse(Library.isSquare(Integer.MIN_VALUE + 1)); assertFalse(Library.isSquare(-8654038)); assertFalse(Library.isSquare(-300)); assertFalse(Library.isSquare(-4)); assertFalse(Library.isSquare(-1)); assertFalse(Library.isSquare(2)); assertFalse(Library.isSquare(3)); assertFalse(Library.isSquare(5)); assertFalse(Library.isSquare(6)); assertFalse(Library.isSquare(7)); assertFalse(Library.isSquare(8)); assertFalse(Library.isSquare(120)); assertFalse(Library.isSquare(9999)); assertFalse(Library.isSquare(Integer.MAX_VALUE - 1)); assertFalse(Library.isSquare(Integer.MAX_VALUE)); }
public static boolean isSquare(int x) { if (x < 0) return false; int y = Library.sqrt(x); return y * y == x; }
Library { public static boolean isSquare(int x) { if (x < 0) return false; int y = Library.sqrt(x); return y * y == x; } }
Library { public static boolean isSquare(int x) { if (x < 0) return false; int y = Library.sqrt(x); return y * y == x; }  }
Library { public static boolean isSquare(int x) { if (x < 0) return false; int y = Library.sqrt(x); return y * y == x; }  static String reverse(String s); static boolean isPalindrome(String s); static boolean isPalindrome(int x); static int sqrt(int x); static long sqrt(long x); static BigInteger sqrt(BigInteger x); static boolean isSquare(int x); static int pow(int x, int y); static int powMod(int x, int y, int m); static int reciprocalMod(int x, int m); static BigInteger factorial(int n); static BigInteger binomial(int n, int k); static int gcd(int x, int y); static boolean isPrime(int x); static boolean[] listPrimality(int n); static int[] listPrimes(int n); static int[] listSmallestPrimeFactors(int n); static int totient(int n); static int[] listTotients(int n); static boolean nextPermutation(int[] arr); }
Library { public static boolean isSquare(int x) { if (x < 0) return false; int y = Library.sqrt(x); return y * y == x; }  static String reverse(String s); static boolean isPalindrome(String s); static boolean isPalindrome(int x); static int sqrt(int x); static long sqrt(long x); static BigInteger sqrt(BigInteger x); static boolean isSquare(int x); static int pow(int x, int y); static int powMod(int x, int y, int m); static int reciprocalMod(int x, int m); static BigInteger factorial(int n); static BigInteger binomial(int n, int k); static int gcd(int x, int y); static boolean isPrime(int x); static boolean[] listPrimality(int n); static int[] listPrimes(int n); static int[] listSmallestPrimeFactors(int n); static int totient(int n); static int[] listTotients(int n); static boolean nextPermutation(int[] arr);  }