How to set Min text(Mandatory) and Max text in edittext

In my edit text box,i want to give some min text as Mandatory and Max text having some limitation like that i want to give in my edittext box,is this any way is there to give like that in my EditText value.

If we will type text the count of numeric has to decrease like that.How to do that one.