code: public static String[] sliceString(String data, int charCount, int[] mainTable, int[] extentionTable) {
          if (data == null)
              return null;
  
          if (mainTable == null)
              return null;
  
          ArrayList<String> res = new ArrayList<String>();
          StringBuilder sb = new StringBuilder();
          int chCnt = 0;
          for (int i1 = 0; i1 < data.length(); i1++) {
              char c = data.charAt(i1);
  
              boolean found = false;
              for (int i = 0; i < mainTable.length; i++) {
                  if (mainTable[i] == c) {
                      found = true;
                      chCnt++;
                      if (chCnt > charCount) {
                          chCnt = 1;
                          res.add(sb.toString());
                          sb = new StringBuilder();
                      }
                      sb.append(c);
                      break;
                  }
              }
              if (!found && extentionTable != null) {
                  for (int i = 0; i < extentionTable.length; i++) {
                      if (extentionTable[i] == c) {
                          found = true;
                          chCnt += 2;
                          if (chCnt > charCount) {
                              chCnt = 2;
                              res.add(sb.toString());
                              sb = new StringBuilder();
                          }
                          sb.append(c);
                          break;
                      }
                  }
              }
              if (!found) {
                  chCnt++;
                  if (chCnt > charCount) {
                      chCnt = 1;
                      res.add(sb.toString());
                      sb = new StringBuilder();
                  }
                  sb.append(c);
              }
          }
  
          res.add(sb.toString());
          String[] arr = new String[res.size()];
          res.toArray(arr);
          return arr;
      }
docs: Slicing of a data String into substrings that fits to characters / septets count in charCount parameter.
  
  @param data
  @return