How can I check if a value is a number or not. Should I use NAN?
U can use static method Character.isDigit(char).
just pass the value as parameter to the NaN function and check the returned value.
Did you mean to test whether or not a String is a number? Or whether an integer value is????
NaN is actually a Java constant and isNaN(...) is a method in Double and Float to test whether a given double or float is NaN, so I'm not sure that will help you.
If you test using Character.isDigit(...) you'll have to loop through the individuals characters of a String. But then beware that values like "1,000.13" would fail because of the comma and decimal point.
Experiment with the parse(...) method in the java.text.NumberFormat class.