Java Code to Convert IP Address to Integer Value
This code will convert the IP Address string to its equivalent decimal value.//Source code IP Address to Integer
String ip="22.244.24.45";
String[] addrArray = ip.split("\.");
long num = 0;
for (int i = 0; i < addrArray.length; i++) {
int power = 3 - i;
num += ((Integer.parseInt(addrArray[i]) % 256 * Math.pow(256, power)));
}