int i = Integer.parseInt([String]);
或
i = Integer.parseInt([String],[int radix]);
还有其他方法吗?
Integer.valueOf()
int b = Integer.valueOf(str).intValue()
String str = "10";
int i1 = Integer.parseInt(str);
int i2 = Integer.valueOf(str).intValue();
如有帮助请采纳!!!!
Integer.valueOf([String])
Integer.parseUnsignedInt([String]);
private static int getint(String str){
int s = 0,len=0,pm = 1;
if(str.indexOf("-")>=0){
pm = -1;
str= str.replace("-","");
}
char[] strs = str.toCharArray();
for (int i = strs.length - 1; i >= 0; i--) {
s += (strs[i]-48)*Math.pow(10,len++);
}
return s*pm;
}