To calculate the starting address of the subnet:
Perform a binary AND operation between the IP address and the subnet mask.
Then to calculate the last address in the subnet range:
Bitwise, invert the subnet mask.
Do a binary OR operation with the first IP address in the subnet.
Read more