Question: A MAC address has the format H H : H H : H H : H H : H H : H H , where

A MAC address has the format HH:HH:HH:HH:HH:HH, where H is any hexadecimal digit. A hexadecimal digit takes on the values 0-9 and A-F (uppercase letters). Write a Java method that takes a variable of type String and returns a boolean value. The method returns true if the argument contains a valid MAC address, and false otherwise. Use the following information:
A valid MAC address length =17
A valid MAC address has the colon character : located at indices 2,5,8,11,14
The method's header is as follows.
public static boolean macValidation(String s)
\table[[Sample run,Result],[\table[[String s ="A0:BC:3A:1F:30:00";],[boolean b = macValidation(s);]],true],[\table[[String s ="BB:FF:AA:AA:CE:EA";],[boolean b = macValidation(s);]],true],[\table[[String s ="AA:BB:00";],[boolean b = macValidation(s);]],false],[\table[[String s ="ZZ:B1:C3:39:1F:3A";],[boolean b = macValidation(s);]],false]]In java.
A MAC address has the format H H : H H : H H : H

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 Finance Questions!