question: private static InetAddress decodeIpv6 ( String input , int pos , int limit ) { byte [ ] address = new byte [ 16 ] ; int b = 0 ; int compress = - 1 ; int groupOffset = - 1 ; for ( int i = pos ; i < limit ; ) { if ( b == address . length ) return null ; if ( i + 2 <= limit && input . regionMatches ( i , "::" , 0 , 2 ) ) { if ( compress != - 1 ) return null ; i += 2 ; b += 2 ; compress = b ; if ( i == limit ) break ; } else if ( b != 0 ) { if ( input . regionMatches ( i , ":" , 0 , 1 ) ) { i ++ ; } else if ( input . regionMatches ( i , "." , 0 , 1 ) ) { if ( ! decodeIpv4Suffix ( input , groupOffset , limit , address , b - 2 ) ) return null ; b += 2 ; break ; } else { return null ; } } int value = 0 ; groupOffset = i ; for ( ; i < limit ; i ++ ) { char c = input . charAt ( i ) ; int hexDigit = decodeHexDigit ( c ) ; if ( hexDigit == - 1 ) break ; value = ( value << 4 ) + hexDigit ; } int groupLength = i - groupOffset ; if ( groupLength == 0 || groupLength > 4 ) return null ; address [ b ++ ] = ( byte ) ( ( value > > > 8 ) & 0xff ) ; address [ b ++ ] = ( byte ) ( value & 0xff ) ; } if ( b != address . length ) { if ( compress == - 1 ) return null ; System . arraycopy ( address , compress , address , address . length - ( b - compress ) , b - compress ) ; Arrays . fill ( address , compress , compress + ( address . length - b ) , ( byte ) 0 ) ; } try { return InetAddress . getByAddress ( address ) ; } catch ( UnknownHostException e ) { throw new AssertionError ( ) ; } }
target:  Decodes an IPv6 address like 1111:2222:3333:4444:5555:6666:7777:8888 or ::1. 