public static Long ipToLong(String ip){ String[] arr = ip.split("[.]"); Long num = 0L; for (int i = 0; i < arr.length; i++) { num = Long.parseLong(arr[i]) | num << 8L; } return num; }
将ip地址转化为10进制
最新推荐文章于 2024-09-27 17:05:12 发布
public static Long ipToLong(String ip){ String[] arr = ip.split("[.]"); Long num = 0L; for (int i = 0; i < arr.length; i++) { num = Long.parseLong(arr[i]) | num << 8L; } return num; }