mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-09 12:11:28 +08:00
Add unit tests for PalindromeNumber (#4227)
This commit is contained in:

committed by
GitHub

parent
8862a4dea5
commit
4b45ac7e71
@ -1,13 +1,6 @@
|
||||
package com.thealgorithms.maths;
|
||||
|
||||
public class PalindromeNumber {
|
||||
|
||||
public static void main(String[] args) {
|
||||
assert isPalindrome(12321);
|
||||
assert !isPalindrome(1234);
|
||||
assert isPalindrome(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if {@code n} is palindrome number or not
|
||||
*
|
||||
@ -17,7 +10,7 @@ public class PalindromeNumber {
|
||||
*/
|
||||
public static boolean isPalindrome(int number) {
|
||||
if (number < 0) {
|
||||
throw new IllegalArgumentException(number + "");
|
||||
throw new IllegalArgumentException("Input parameter must not be negative!");
|
||||
}
|
||||
int numberCopy = number;
|
||||
int reverseNumber = 0;
|
||||
|
Reference in New Issue
Block a user