class ByteUtil {

    public static void replace(final byte[] buffer, final int offset, final int length,
                               final byte target, final byte replacement)
    {
        for (int i = 0; i < length; i++)
        {
            int location = i + offset;
            if (target == buffer[location])
            {
                buffer[location] = replacement;
            }
        }
    }

}