question: public static boolean isNumber ( String str ) { if ( str == null ) return false ; str = str . trim ( ) ; int pos = 0 ; int len = str . length ( ) ; if ( len == 0 ) return false ; char curr = str . charAt ( pos ) ; if ( curr == '+' || curr == '-' ) { if ( len == ++ pos ) return false ; curr = str . charAt ( pos ) ; } boolean hasDot = false ; boolean hasExp = false ; for ( ; pos < len ; pos ++ ) { curr = str . charAt ( pos ) ; if ( curr < '0' ) { if ( curr == '.' ) { if ( pos + 1 >= len || hasDot ) return false ; hasDot = true ; } else return false ; } else if ( curr > '9' ) { if ( curr == 'e' || curr == 'E' ) { if ( pos + 1 >= len || hasExp ) return false ; hasExp = true ; hasDot = true ; } else return false ; } } if ( hasExp ) { try { Double . parseDouble ( str ) ; return true ; } catch ( NumberFormatException e ) { return false ; } } return true ; }
target:  tests if String value is Numeric