code: public static boolean endsWith(StringBuffer buffer, String suffix)
      {
          if (suffix.length() > buffer.length()) 
              return false;
          int endIndex = suffix.length() - 1;
          int bufferIndex = buffer.length() - 1;
          while (endIndex >= 0)
          {
              if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex))
                  return false;
              bufferIndex--;
              endIndex--;
          }
          return true;
      }
docs: Checks that a string buffer ends up with a given string.
  @param buffer The buffer to perform the check on
  @param suffix The suffix
  @return <code>true</code> if the character sequence represented by the
  argument is a suffix of the character sequence represented by
  the StringBuffer object; <code>false</code> otherwise. Note that the
  result will be <code>true</code> if the argument is the empty string.