How would you check if a String was a number before parsing it?
if you are on android, then you should use:
android.text.TextUtils.isDigitsOnly(CharSequence str)
documentation can be found here
keep it simple. mostly everybody can "re-program" (the same thing).