JAVA O(N) time complexity, beat 100%
IntuitionTry to find the number of element in the array, and make the new string in the array with stringbuilderApproachfirst start from 1, to find the proper l
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Try to find the number of element in the array, and make the new string in the array with stringbuilder
# Approach
<!-- Describe your approach to solving the problem. -->
first start from 1, to find the proper length of array, to make the last element of array can be filled, and remaining any char in the string, then use stringbuilder to form every element in the array. 
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(n)$$
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
$$O(n)$$
# Code
```java []
class Solution {
    public String[] splitMessage(String message, int limit) {
        int num = 0;
        int numL=0;
        if (message.length() == 0)
            return new String[0];
        for (int i = 1; i <= 9999; i++) {
            if (i < 10) {
                int newlen = 5 * i + message.length();
                numL=1;
                if (newlen >= (limit * (i - 1) + 1) && newlen <= (limit * i)) {
                    num = i;
                    break;
                }

            } else if (i >= 10 && i < 100) {
                numL=2;
                int newlen = 6 * 9 + 7 * (i - 9) + message.length();
                if (newlen >= (limit * (i - 1) + 1) && newlen <= (limit * i)) {
                    num = i;
                    break;
                }
            } else if (i >= 100 && i < 1000) {
                numL=3;
                int newlen = 7 * 9 + 8 * 90+9*(i-99) + message.length();
                if (newlen >= (limit * (i - 1) + 1) && newlen <= (limit * i)) {
                    num = i;
                    break;
                }
            }else if (i >= 1000 && i < 10000) {
                numL=4;
                int newlen = 8 * 9 + 9 * 90+10*900 + 11*(i-999) +message.length();
                if (newlen >= (limit * (i - 1) + 1) && newlen <= (limit * i)) {
                    num = i;
                    break;
                }
            }

        }
        String[] res=new String[num];
        int start=0; 
        int end=0; 
        //System.out.println(num);
        for(int i=1;i<=num;i++){
           
            StringBuilder sb=new StringBuilder();
            int textLen=0;
            if(i<10){
                textLen=limit-3-numL-1;
               
            }else if(i<100){
                 textLen=limit-3-numL-2;
            }else if(i<1000){
                 textLen=limit-3-numL-3;
            }else{
                  textLen=limit-3-numL-4;
            }
             end=Math.min(start+textLen,message.length());
             sb.append(message.substring(start,end));
             sb.append('<');
             sb.append(i);
             sb.append('/');
             sb.append(num);
             sb.append('>');
             res[i-1]=sb.toString();
             start=end; 
        }
        return res; 
    }
}
```
['Java']