Why we need special check here? can it be just
if(mark.contains(' ')) thr
for (String each : mark.split("\\.")) if each.isEmpty() thr
?