am 4b1bdc02: Merge "DO NOT MERGE Fixing Connectivity" into gingerbread
Merge commit '4b1bdc0209650436ebe0dad1020080cc891e97b6' into gingerbread-plus-aosp * commit '4b1bdc0209650436ebe0dad1020080cc891e97b6': DO NOT MERGE Fixing Connectivity
This commit is contained in:
commit
57c5c01d5e
1 changed files with 15 additions and 0 deletions
|
|
@ -128,4 +128,19 @@ public class NetworkUtils {
|
|||
| (addrBytes[0] & 0xff);
|
||||
return addr;
|
||||
}
|
||||
|
||||
public static int v4StringToInt(String str) {
|
||||
int result = 0;
|
||||
String[] array = str.split("\\.");
|
||||
if (array.length != 4) return 0;
|
||||
try {
|
||||
result = Integer.parseInt(array[3]);
|
||||
result = (result << 8) + Integer.parseInt(array[2]);
|
||||
result = (result << 8) + Integer.parseInt(array[1]);
|
||||
result = (result << 8) + Integer.parseInt(array[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue