List of utility methods to do IP Address to Long
long[] | ipv4CidrToLong(String networkCidr) Converts String[] strNets = networkCidr.split("/"); return new long[] { ipV4AddressToLong(strNets[0]), convertStrCidrToLong(strNets[1]) }; |
long | ipV4ToLong(final String ipAddress) ip V To Long long result = 0; String[] atoms = ipAddress.split("\\."); for (int i = 3; i >= 0; i--) { result |= (Long.parseLong(atoms[3 - i]) << (i * 8)); return result & 0xFFFFFFFF; |
long | ipv4ToLong(final String ipv4) IPv4 to Long. if (ipv4 == null) { return -1L; final int length = ipv4.length(); if (length < 7 || length > 15) { return -1L; char[] chars = new char[length + 1]; ... |
long | ipV4ToLong(String ip) ip V To Long String[] octets = ip.split("\\."); return (Long.parseLong(octets[0]) << 24) + (Integer.parseInt(octets[1]) << 16) + (Integer.parseInt(octets[2]) << 8) + Integer.parseInt(octets[3]); |