So my program that I am creating is going to calculate the subnet of an IP address that is given. It is being written in java. The program asks for the IP address that will always be given in the form 255.255.255.255. The plan is to separate a part of the string, then wrap it into an integer.
I need to extract each of the 4 quadrants as separate integers. The trick I can't figure out is how to do this when the IP looks more like 192.168.1.20. How would I be able to do this and get reliable results.
User input : 192.168.205.16
Created Variables :
Quadrant1 : 192
Quadrant2 : 168
Quadrant3 : 205
Quadrant4 : 16