Use the following method from Integer API
parseInt
public static int parseInt(String s)
throws NumberFormatExceptionParses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method.
If it throws NumberFormatException its alphanumeric else its numeric.You would however have to remove any spaces or commas etc. since they are not mumeric either
> Use the following method from Integer API
>
> public static int parseInt(String s)
Note to the OP however that will only work if the number represented by the string is small enough. If the string is something like "1234567889012349283472938572983562935862938562985629586", that won't work yet it still contains all numbers.
Also, parseInt will also allow for a leading '-' character, which is clearly not a "number" (digit).
> > Use the following method from Integer API
> >
> > public static int parseInt(String s)
> Note to the OP however that will only work if the
> number represented by the string is small enough. If
> the string is something like
> "12345678890123492834729385729835629358629385629856295
> 86", that won't work yet it still contains all
> numbers.
> Also, parseInt will also allow for a leading '-'
> character, which is clearly not a "number" (digit).
I stand corrected.
> "Love Me Like You" was composed by the Magic Numbers,
> would that pass the test? :o)
In computer programming, a magic number is a special constant used for some specific purpose. It is called magic because its value or presence is inexplicable without some additional knowledge.
Dixit www.reference.com