code: private static int countSpacesLeft(char[] dest,
                                         int start,
                                         int count) {
          for (int i = start, e = start + count; i < e; ++i) {
              if (dest[i] != SPACE_CHAR) {
                  return i - start;
              }
          }
          return count;
      }
docs: /*
  Name    : countSpaces
  Function: Counts the number of spaces
  at each end of the logical buffer