public static boolean isAllNumber ( String str ) { boolean hasNumber = false ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( ! ( Character . isDigit ( str . charAt ( i ) ) || str . charAt ( i ) == ' ' || str . charAt ( i ) == ' ' || str . charAt ( i ) == ' ' || str . charAt ( i ) == ' ' || str . charAt ( i ) == ' ' ) ) { return false ; } else if ( Character . isDigit ( str . charAt ( i ) ) ) hasNumber = true ; } if ( hasNumber == true ) return true ; else return false ; }
Checks if is all number .