There are a few ways to do it...
The Character class has a method to check if a individual character is a digit. You can break your input
string into characters and check each character to see if it forms a the digits for the number.
If you feel comfortable with Regular Expressions, you can use the strings matches() method to see if it is a number... like so...
input.matches("\\d+");
Of course, if this is a homework problem, then you probably are expected to check each character directly -- depending on the restrictions of your assignment.
Henry