bundles/org.tukani.xz/src/org/tukaani/xz/lz/LZEncoder.java
public int getMatchLen(int forward, int dist, int lenLimit) {
        int curPos = readPos + forward;
        int backPos = curPos - dist - 1;
        int len = 0;

        while (len < lenLimit && buf[curPos + len] == buf[backPos + len])
            ++len;

        return len;
    }
public int getMatchLen(int forward, int dist, int lenLimit) {
        int curPos = readPos + forward;
        int backPos = curPos - dist - 1;
        int len = 0;

        while (len < lenLimit && buf[curPos + len] == buf[backPos + len])
            ++len;

        return len;
    }
public int getMatchLen ( int forward , int dist , int lenLimit ) { int curPos = readPos + forward ; int backPos = curPos - dist - 1 ; int len = 0 ; while ( len < lenLimit && buf [ curPos + len ] == buf [ backPos + len ] ) ++ len ; return len ; }
Get the length of a match at the given distance and forward offset.

@param       forward     forward offset
@param       dist        zero-based distance of the match to test
@param       lenLimit    don't test for a match longer than this

@return      length of the match; it is in the range [0, lenLimit]
Get the length of a match at the given distance and forward offset .