import java.util.StringTokenizer;

/*
 * Created on 18/03/2004
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
/**
 * @author augusto
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class Mascara
{
    public boolean validatorMask( String formatMask  , String  str  )
    {
        boolean ok = false;
        StringTokenizer tokenMask = new  StringTokenizer( formatMask , "." );
        StringTokenizer tokenStr = new  StringTokenizer( str , "." );
        
        int numberElementMask = tokenMask.countTokens();
        int numberElementStr =  tokenStr.countTokens();
        if( numberElementMask != numberElementStr  )
        {
            ok = false;
            return ok;
        }
        while( tokenMask.hasMoreTokens()  )
        {
            String strMask   = tokenMask.nextToken();
            String strFormat = tokenStr.nextToken();
            if( strMask.length() == strFormat.length() )
            {
                ok = true;
            }
            else
            {
                ok = false;
                return ok;
            }
        }
        return ok;
    }
	public static void main(String[] args)
	{
      boolean isTrue = new Mascara().validatorMask( "##.#.#.##.#.###" , "10.6.0.44.2.090 "  );
      System.out.println( "Mascara está ok " + isTrue );
	}
}

