实现SMS消息计数序列

时间:2011-09-28 14:42:37

标签: java

我正在尝试实现一个消息计数器(用于计算在SMS中输入的字符数),这应该从160减少到零(对于第一页)增加第二页然后重新计数但是对于后续页面,此时间从159开始下降到0。我该怎么做

int pgNo;

public int PageNumber(int length, int maxchar) // this is for the page number
    {
        pgNo = ((length / maxchar) + 1);
        return pgNo;
    }

    public int CharCount(int length, int maxchar)// this is for determining the count in that page
    {
        int num = length % maxchar; // num is the count of the page
        if (num == 0 && length == 0) // checking to determine either 0 or maxchar is to be displayed
        {
            num = maxchar;                // e.g. 0/100 or 100/100
        }
        return maxchar - num;
    }

0 个答案:

没有答案