byte[] address = ia.getAddress();
if (address.length != 4) {
throw new IllegalArgumentException("Do not understand IPv6 addresses!");
}
int firstByte = address[0];
if ((firstByte & 0x80) == 0) return 'A";
else if ((firstByte & 0xC0) == 0x80) return 'B";
else if ((firstByte & 0xE0) == 0xC0) return 'C";
else if ((firstByte & 0xF0) == 0xE0) return 'D";
else if ((firstByte & 0xF8) == 0xF0) return 'E";
else return 'F";