question: public static IP parseFromString ( String ip ) { String regex = "\\s*(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\s*" ; Pattern pattern = Pattern . compile ( regex ) ; Matcher m = pattern . matcher ( ip ) ; checkArgument ( m . find ( ) , "IP string should match the regex:%s" , regex ) ; int a = Integer . parseInt ( m . group ( 1 ) ) ; int b = Integer . parseInt ( m . group ( 2 ) ) ; int c = Integer . parseInt ( m . group ( 3 ) ) ; int d = Integer . parseInt ( m . group ( 4 ) ) ; return new IP ( a , b , c , d ) ; }
target:  Creates a IP instance by a string.