public static String simpleHostname ( String fullHostname ) { if ( InetAddresses . isInetAddress ( fullHostname ) ) { return fullHostname ; } int offset = fullHostname . indexOf ( ' ' ) ; if ( offset != - 1 ) { return fullHostname . substring ( 0 , offset ) ; } return fullHostname ; }
Given a full hostname return the word upto the first dot .