code: public boolean endsWith(byte[] prefix) {
          //logger.debug("Inside endsWith()");
          if ((prefix.length == 0) || (prefix.length > size())) {
              //It could not match :
              return false;
          }
          boolean match = true;
          int i = prefix.length - 1;
          int j = (this.currentWritePosition - 1 + this.buffer.length) % this.buffer.length;
          while (match && (i >= 0)) {
              //logger.debug("endsWith() this.buffer["+j+"]=" + this.buffer[j] + "='" + (char)this.buffer[j] + "', prefix["+i+"]=" + prefix[i] + "='" + (char)prefix[i] + "'");
              if (this.buffer[j] != prefix[i]) {
                  match = false;
              }
              i--;
              j = (j - 1 + this.buffer.length) % this.buffer.length;
          }
          return match;
      }
docs: Tests if the buffer ends with the bytes array prefix. The byte array
  prefix must have a size >= this buffer's size.
  @return True if the buffer ends with the bytes array, otherwise false.