How to verify if a IP address is valid on Java? : <p>I want to verify an IP address in java, how can I do that?
The IP Address needs to be in this format: xxx.xxx.xxx.xxx
Each octet range must be 0 ~ 255.</p>

<p>Since the IP is verified, the code must show a message telling that the IP is valid or not. If not, the user must type the IP again.</p>

<p>I've done the method to convert an IP string to an array of integers so far...</p>

<pre class="lang-java prettyprint-override"><code>
public static void verify() {
        Scanner input = new Scanner(System.in);     
        System.out.println("IP: (xxx.xxx.xxx.xxx)");
        String ipAddress = input.nextLine();
        int[] arrayIpAddress = Arrays.stream(ipAddress.split("\\.")).mapToInt(Integer::parseInt).toArray();
}

</code></pre>
