code: private synchronized int seekCountry(long ipAddress) {
          byte[] buf = new byte[2 * MAX_RECORD_LENGTH];
          int[] x = new int[2];
          int offset = 0;
          _check_mtime();
          for (int depth = 31; depth >= 0; depth--) {
              readNode(buf, x, offset);
  
              if ((ipAddress & (1 << depth)) > 0) {
                  if (x[1] >= databaseSegments[0]) {
                      last_netmask = 32 - depth;
                      return x[1];
                  }
                  offset = x[1];
              } else {
                  if (x[0] >= databaseSegments[0]) {
                      last_netmask = 32 - depth;
                      return x[0];
                  }
                  offset = x[0];
              }
          }
          throw new InvalidDatabaseException("Error seeking country while searching for "
                  + ipAddress);
      }
docs: Finds the country index value given an IP address.
  
  @param ipAddress
  the ip address to find in long format.
  @return the country index.