Trying to make a loop of MAC address values with:
String macAddr = "AA:BB:CC:DD:";
char[] chars = {'A', 'B', 'C', 'D', 'E', 'F'};
String[] strings = {"0", "0", "0", "0"};
for (int i=0; i<strings.length; i++)
{
//counter from 0 to F
for (int d = 0; d <= 9; d++)
{
strings[i] = ""+d;
print();
}
for (int d = 0; d< chars.length; d++)
{
strings[i] = ""+chars[d];
print();
}
}
where print() is:
System.out.println(macAddr+strings[3]+strings[2]+":"+strings[1]+strings[0]);
But i’m getting run-over:
AA:BB:CC:DD:00:0D
AA:BB:CC:DD:00:0E
AA:BB:CC:DD:00:0F
AA:BB:CC:DD:00:0F
AA:BB:CC:DD:00:1F
AA:BB:CC:DD:00:2F
AA:BB:CC:DD:00:3F
The two problems are the dual values at each crossover (e.g. AA:BB:CC:DD:00:0F)
and the values stopping at F on each value.
I’m trying to get them as:
AA:BB:CC:DD:00:0D
AA:BB:CC:DD:00:0E
AA:BB:CC:DD:00:0F
AA:BB:CC:DD:00:11
AA:BB:CC:DD:00:12
AA:BB:CC:DD:00:13
etc.
Cheers 🙂
Try this for keeping it simple:
Output (abbreviated):