question: public static Number createNumber ( String str ) throws ParseException { try { if ( str . indexOf ( '.' ) != - 1 ) { return Double . valueOf ( str ) ; } else { return Long . valueOf ( str ) ; } } catch ( NumberFormatException e ) { throw new ParseException ( e . getMessage ( ) ) ; } }
target:  Create a number from a String. If a . is present, it creates a Double, otherwise a Long.