I am trying to split an IP address by ".". But code is generating an exception.
Exception Message : "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at decimaltobinary.DecimalToBinary.main".
Help me to solve. Here is my Code.
String[] ipAddresses=IP.split(".");
String ip1=ipAddresses[0];
String ip2=ipAddresses[1];
String ip3=ipAddresses[2];
String ip4=ipAddresses[3];