}
    private synchronized int seekCountry(long ipAddress) {	    byte [] buf = new byte[2 * MAX_RECORD_LENGTH];	    int [] x = new int[2];        int offset = 0;        for (int depth = 31; depth >= 0; depth--) {            if ((dboptions & GEOIP_MEMORY_CACHE) == 1) {		//read from memory                for (int i = 0;i < 2 * MAX_RECORD_LENGTH;i++) {		    buf[i] = dbbuffer[(2 * recordLength * offset)+i];		}            } else {	       //read from disk 		try {                    file.seek(2 * recordLength * offset);                    file.read(buf);                }                catch (IOException e) {                    System.out.println("IO Exception");                }            }            for (int i = 0; i<2; i++) {                x[i] = 0;                for (int j = 0; j<recordLength; j++) {                    int y = buf[i*recordLength+j];                    if (y < 0) {                        y+= 256;                    }                    x[i] += (y << (j * 8));                }            }            if ((ipAddress & (1 << depth)) > 0) {                if (x[1] >= databaseSegments[0]) {                    return x[1];                }                offset = x[1];            }            else {                if (x[0] >= databaseSegments[0]) {                    return x[0];                }                offset = x[0];	        }	    }        // shouldn't reach here        System.err.println("Error seeking country while seeking " + ipAddress);        return 0;    }