0

Hello;

What would be the most efficient way to get all of the 2^24 network identifiers for the given A class IP address. I am aware it is a very stupid question, and a inpractical one for that matter but thank you for any input. Im trying to speed up and enhance this algorithm here :

```
/**
* @author joey
*
* Example subnet -> 13.0.0.0/31 where 13 is a
* @param octet
* houses the subnet mask octet index which holds last ON
* bit [values range from 1-4, 4 being the last octet]
* @param tempo
* houses the last ON bit in the subnet mask converted to
* decimal which we then use as a step between network
* ids [possible values are 256,128,64,32,16,8,4,2,1]
* @param (in1, in2, in3, i, j, k) various helper vars
* @param z
* counter var
* @param a
* first IP address octet
* */
if (octet == 4) {
in3 = tempo;
in1 = in2 = 1;
for (i = z = 0; i < 256; i += in1)
for (j = 0; j < 256; j += in2)
for (k = 0; k < 256; k += in3, z++) {
System.out.println(a + "." + i + "." + j + "." + k);
}
}
```

*Edited
by Joey_Brown*: n/a