Add utils to convert Inet4Address <-> int
The current utilities map the higher-order bytes of ints to the lower-order bytes of IPv4 addresses, which makes applying masks and generating series of addresses confusing. For example, the current utilities would convert 1.2.3.4 to 0x04030201, or generate 0x0080ffff for a /17 subnet mask. The utilities in this CL convert 1.2.3.4 to 0x01020304, and a /17 subnet mask is represented as 0xffff8000. Includes tests for all the above methods and migration of NetworkUtilsTest to JUnit4. Test: added tests pass Change-Id: I5f5aa2e6e3b054b66b9dc507dab64f41be9139b1
Loading
Please register or sign in to comment