160 characters limit for SMS messages
<p>I have one field which can contain from 1 to unlimited number of characters. I want to restrict to send maximum 3 messages (so minimum 1 maximum 3). So it is maximum 480 characters. I want to list (write in output) each message separately (from 0-160; 160-320; 320-480).All over the 480 is not my concern.</p>

<p>My class  works when there are on example 500 characters but for small number of characters like in example it wont work.</p>

<pre><code> String message="message to sent";
 int m=message.length();


b=160;
int c=m/b;


int bi=0;
int ei=160;



for (int i = 0; i &lt; c; i++) {
    while (ei&lt;=480)
    {
    System.out.println("\n"+message.substring(bi, ei));
    bi=bi+160;
    ei=ei+160;
    }
}
</code></pre>

<p>what do I have to correct to work this completely and for small number of characters in message and for large messages?
    thank you</p>
