final static int comparePrefix(char[] key, Page pg, int i) { 
        int alen = key.length;
        int blen = BtreePage.getKeyStrSize(pg, i);
        int minlen = alen < blen ? alen : blen;
        int offs = BtreePage.getKeyStrOffs(pg, i) + BtreePage.firstKeyOffs;
        byte[] b = pg.data;
        for (int j = 0; j < minlen; j++) { 
            int diff = key[j] - (char)Bytes.unpack2(b, offs);
            if (diff != 0) { 
                return diff;
            }
            offs += 2;
        }
        return minlen - blen;
    }