private boolean isValid(String head) {
        if( head.length() > 3 ) return false;

        int n = Integer.valueOf( head );
        int length = head.length();

        if( n >= 100 && n <= 255 ) return true;

        if( n >= 10 && n < 100 && length == 2 ) return true;
        if( n >= 0 && n <= 9 && length == 1 ) return true;

        return false;
    }