What I appreciate about this forum is that the answer is not given but the way is pointed out.
Considering that we are both beginners, let me show you how I would tackle this task:
MAC Address: Let's Google what that is.
At that link it talks about Unicast vs Multicast. So what is the difference?
Unicast: When the least significant bit of an address's first octet is 0.
Multicast: When the least significant bit of an address's first octet is 1.
Your teacher has told you that with the MAC address of 18:30:FA:AB:FF:11, you need to take 18 and perform 18 mod 2 = 0 then it is Unicast. I prefer to understand why mod 2 = 0 is correct, instead of just using it.
I searched for Unicast and Multicast examples and found this very clear video:
Let's take the 18 from the example MAC address and convert it into binary. I searched for a hex to binary converter and found this:
18 in binary is: 00011000
The least significant bit, is the number on the far right, which is a zero, so this MAC address is a Unicast MAC Address.
With the groundwork out the way of understanding what we are trying to achieve, lets turn this into code.
The teacher asked the following:
1. Create random MAC addresses
2. The Random Address put it in an array
3. Split the array and take the part i need and
4. Check what type it is
Step 1: I would tackle this part last, or ask the teacher for more clarity on what is expected.
Step 2: We have an example MAC address, so let's use it.
Step 3: Let's search how to do that.
Step 4: We know how to do this from our research, or from the teacher's hint.
Do you know how to save a string into a variable?
If yes, save the MAC address as a variable. If not, search for an example.
Now that we have the MAC address saved as a string, we need to split it into octets.
What is the first octet?
How can you tell where the first octet ends and the second octet starts?
You already know the answer. The octets are separated by a colon.
Search: Java example how to split a string by colon
Now we want to create an array, as per the task requirement where the array stores the pieces of the MAC address that have been split.
How to create a string array?
Search: Java example how to create a string array
Now that we have the string array that is equal to our mac address that has been split by colon, we need to access the first octet, in this example, the 18.
Search: Java example how to access first number in a string array
Before we can convert 18 into binary, we need to convert the string into a number:
Search: Java example how to convert a string into a number.
Now that you have the number 18, we need to convert that number to decimal.
Search: Java convert hex to binary
Now that you have the number in binary, you can ask the question, is the last digit a 0 or a 1.
Search: Java how to find least significant bit of binary number.
Note: This goes deep down a rabbit hole, that you may want to tackle, or avoid for now. Maybe you rather want to use 18 mod 2 = 0 on an integer, but if you do, you must understand why 18 mod 2 = 0 gives the right answer.
This is a great task to stretch you beyond what you currently know.
Thank you for posting this task, I learnt many thing I didn't know yesterday.
Try thinking of programming like that. Yesterday, you had 5 tools in your toolbox, and by the end of today, you may have 10 or 15.
You definitely can do this