static int inet4AsInt ( InetAddress ia ) { if ( ia instanceof Inet4Address ) { byte [ ] addr = ia . getAddress ( ) ; int address = addr [ 3 ] & 0xFF ; address |= ( ( addr [ 2 ] << 8 ) & 0xFF00 ) ; address |= ( ( addr [ 1 ] << 16 ) & 0xFF0000 ) ; address |= ( ( addr [ 0 ] << 24 ) & 0xFF000000 ) ; return address ; } throw new AssertionError ( "Should not reach here" ) ; }
Returns an IPv4 address as an int .