code: private static long bytesToLong(byte[] address) {
          long ipnum = 0;
          for (int i = 0; i < 4; ++i) {
              long y = address[i];
              if (y < 0) {
                  y += 256;
              }
              ipnum += y << ((3 - i) * 8);
          }
          return ipnum;
      }
docs: Returns the long version of an IP address given an InetAddress object.
  
  @param address
  the InetAddress.
  @return the long form of the IP address.