code: private static int countSpaceSub(char [] dest,int length, char subChar){
          int i = 0;
          int count = 0;
          while (i < length) {
            if (dest[i] == subChar) {
                count++;
                }
            i++;
          }
          return count;
      }
docs: /*
  Name    : countSpaceSub
  Function: Counts number of times the subChar appears in the array