Formatted with Google Java Formatter

This commit is contained in:
github-actions
2020-10-24 10:23:28 +00:00
parent a23bac99e8
commit 5d59a2e828
219 changed files with 13758 additions and 14582 deletions

View File

@ -1,25 +1,23 @@
package Maths;
/**
* https://en.wikipedia.org/wiki/Perfect_square
*/
/** https://en.wikipedia.org/wiki/Perfect_square */
public class PerfectSquare {
public static void main(String[] args) {
assert !isPerfectSquare(-1);
assert !isPerfectSquare(3);
assert !isPerfectSquare(5);
assert isPerfectSquare(9);
assert isPerfectSquare(100);
}
public static void main(String[] args) {
assert !isPerfectSquare(-1);
assert !isPerfectSquare(3);
assert !isPerfectSquare(5);
assert isPerfectSquare(9);
assert isPerfectSquare(100);
}
/**
* Check if a number is perfect square number
*
* @param number the number to be checked
* @return <tt>true</tt> if {@code number} is perfect square, otherwise <tt>false</tt>
*/
public static boolean isPerfectSquare(int number) {
int sqrt = (int) Math.sqrt(number);
return sqrt * sqrt == number;
}
}
/**
* Check if a number is perfect square number
*
* @param number the number to be checked
* @return <tt>true</tt> if {@code number} is perfect square, otherwise <tt>false</tt>
*/
public static boolean isPerfectSquare(int number) {
int sqrt = (int) Math.sqrt(number);
return sqrt * sqrt == number;
}
}