class IpUtils {

  public static long getIpNum(String ipAddress) {
    if (!isValidIPv4(ipAddress)) {
      throw new BusinessException("IpUtils.getIpNum:传入的IP地址[" + ipAddress + "]无效，请检查！");
    }

    String[] ip = ipAddress.split("\\.");
    long a = Integer.parseInt(ip[0]);
    long b = Integer.parseInt(ip[1]);
    long c = Integer.parseInt(ip[2]);
    long d = Integer.parseInt(ip[3]);

    long ipNum = a * IP_MULTIPLE_A + b * IP_MULTIPLE_B + c * IP_MULTIPLE_C + d;
    return ipNum;
  }

}