Question: Define the isValidIpAddress and generateRandomIpAddress methods such that they work as described below: public static boolean isValidIpAddress(String testIpAddress) : This method takes an IP address

Define the isValidIpAddress and generateRandomIpAddress methods such that they work as described below:

  • public static boolean isValidIpAddress(String testIpAddress): This method takes an IP address argument in textual form (i.e. 127.23.66.11). It should then examine this string and determine if it is in a proper IP Address format. This means it has four numbers in the range 0-255 each separated by a '.' and that there are no additional characters or symbols (no extra '.'s either). Your method should return true if it is valid, false otherwise. Note, that I am not expecting you to verify whether the IP address argument is a valid computer address or not, just whether it uses the proper format.
  • public static String generateRandomIpAddress(): This method should generate random IP address and return it as a String. Note that for each of the four numeric components, they should be randomly chosen numbers in the range 0-255 with equal likelihood for each number.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!