[Java]: Parse numbers based on type.