// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class FormatCheckHack {
    public static boolean is37digit(String s)
    {
        int ix = s.indexOf('.');
        if(ix < 1) return false;
        if(ix > 3) return false;
        for(int i = 0; i < ix; i++) if(!Character.isDigit(s.charAt(i))) return false;
        if(s.length() - ix - 1 < 1) return false;
        if(s.length() - ix - 1 > 7) return false;
        for(int i = ix + 1; i < s.length(); i++) if(!Character.isDigit(s.charAt(i))) return false;
        return true;
    }
    public static void main(String[] args) {
        System.out.println(is37digit("123.456"));
        System.out.println(is37digit("123.4567899"));
        System.out.println(is37digit("1123.4567899"));
    }
}
