Converting String to int in Java and getting a NumberFormatException, can't figure out why
- by user1687682
ipString is a String representation of an IP address with spaces instead of dots.
String[] ipArray = ipString.split(" ");
String ip = "";
for (String part : ipArray){
    if (part != null){
        ip += part
    }
}
ip = ip.trim();
int ipInt = Integer.parseInt(ip);    // Exception is thrown here.
Exception in thread "main" java.lang.NumberFormatException: For input string: "6622015176".
Could someone explain why this exception is being thrown?