code: public static int checkEncodedDataLengthInChars(String data, int[] mainTable, int[] extentionTable) {
          if (data == null)
              return 0;
  
          if (mainTable == null)
              return 0;
  
          int cnt = 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;
                      cnt++;
                      break;
                  }
              }
              if (!found && extentionTable != null) {
                  for (int i = 0; i < extentionTable.length; i++) {
                      if (c != 0 && extentionTable[i] == c) {
                          found = true;
                          cnt += 2;
                          break;
                      }
                  }
              }
              if (!found)
                  cnt++;
          }
  
          return cnt;
      }
docs: Returns a count in characters / septets of the data String after which the String will be GSM7 style encoded. For all
  characters from the extension character table two bytes will be reserved. For all characters from the main character
  table or which are not present in main or extension character tables one byte will be reserved.
  
  @param data
  @return