Refactor InetAddress.parseNumericAddress/isNumeric

The parseNumericAddress and isNumeric methods in InetAddress are used
by apps even though they are not part of the public API. The methods
do more than one thing (parse numeric numbers, extract IPv6 addresses
from inside URL hosts as described in RFC 2732, and provide access to
loopback addresses) and so are not good candidates for exposing as is
in the public API.

Extracting IPv6 addresses is easy to do using standard Java, and the
loopback addresses are already available through other InetAddress
classes. So, this change extracts functionality for parsing numeric
addresses out into a new InetAddressUtils class (with corresponding
tests) that can be then be used as the basis for a public API.

Tested by running:
  atest core-tests:libcore.java.net.InetAddressTest \
        core-tests:libcore.libcore.net.InetAddressUtilsTest \
	CtsNetTestCases:android.net.cts.InetAddressesTest

Bug: 78686891
Test: as above
Change-Id: Ie9eaf5356e1c573ea59dfbb41f9d23cfef14e82c
7 files changed