Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static IPAddress fromString(String string) throws IPFormatException{
- String[] splittedString = string.split("\\.");
- int[] tempArray = new int[4];
- if(splittedString.length == 4) {
- int i = 0;
- for(String elements : splittedString) {
- tempArray[i] = Integer.parseInt(elements);
- i++;
- }
- } else {
- throw new IPFormatException(string);
- }
- return new IPAddress(tempArray);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement