Add a period character to the regular expression as follows:
if(parts_s1[0].matches("[0-9.]*")) {
* - allow multiple digits / decimal points.
If at least one digit / decimal point is required, replace * with + for one or more occurrences.
EDIT:
If a regular expression must match (positive) decimal numbers (and not just arbitrary sequences of digits and decimal points), a better example would be:
if(parts_s1[0].matches("\\d*\\.?\\d+")) {
Note that \\d equivalent to [0-9] .
source share