+\r
+ /**\r
+ Convert a string to a integer.\r
+ \r
+ @param intString The string representing a integer\r
+ \r
+ @retval int The value of integer represented by the\r
+ given string; -1 is returned if the format\r
+ of the string is wrong.\r
+ **/\r
+ private int stringToInt(String intString) {\r
+ int value;\r
+ int hexPrefixPos = intString.indexOf("0x");\r
+ int radix = 10;\r
+ String intStringNoPrefix;\r
+\r
+ if (hexPrefixPos >= 0) {\r
+ radix = 16;\r
+ intStringNoPrefix = intString.substring(hexPrefixPos + 2, intString.length());\r
+ } else {\r
+ intStringNoPrefix = intString;\r
+ }\r
+\r
+ try {\r
+ value = Integer.parseInt(intStringNoPrefix, radix);\r
+ } catch (NumberFormatException e) {\r
+ log("Incorrect format of int (" + intString + "). -1 is assumed");\r
+ return -1;\r
+ }\r
+\r
+ return value;\r
+ }\r