public static boolean isDigitsOnly ( CharSequence str ) { final int len = str . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( ! Character . isDigit ( str . charAt ( i ) ) ) { return false ; } } return true ; }
Returns whether the given CharSequence contains only digits .