private long locateIP(byte[] ip) {
		long m =0;
		int r;
		readIP(ipBegin, b4);
		r =compareIP(ip, b4);
		if (r ==0) return ipBegin;
		else if (r <0) return -1;
		
		for (long i =ipBegin, j =ipEnd; i <j;) {
			m =getMiddleOffset(i, j);
			readIP(m, b4);
			//System.out.println(Integer.toHexString(b4[0]) +Integer.toHexString(b4[1]) +Integer.toHexString(b4[2]) +Integer.toHexString(b4[3]));
			r =compareIP(ip, b4);
			if (r >0) i =m;
			else if (r <0) {
				if (m ==j) { //when j ==i +IP_RECORD_LENGTH
					j -= IP_RECORD_LENGTH;
					m =j;
				}
				else j =m;
			}
			else return readLong3(m +4);
		}
		
		m =readLong3(m +4);
		readIP(m, b4);
		if (compareIP(ip, b4) <=0) return m;
		else return -1;
	}