public static String getIP ( final InetAddress inetAddress ) { String ip = "" ; ip = inetAddress . getHostAddress ( ) ; if ( ip . equals ( "" ) ) { final byte [ ] ipAddressInBytes = inetAddress . getAddress ( ) ; for ( int i = 0 ; i < ipAddressInBytes . length ; i ++ ) { if ( i > 0 ) { ip += "." ; } ip += ipAddressInBytes [ i ] & 0xFF ; } } return ip ; }
Gets the ip address from the given InetAddress object as a String .