减去字符0的ASCII码值(48) 这样的方法适用于大数处理。 代码示例如下: //the method of char2int char ch = '1'; int n = ch - '0'; //the method of String2int String str = "1234"; int total; total = 0; for(int i = 0; i < str.length(); i++){ total *= 10; total += str.charAt(i) - '0'; } Integer.parseInt(String)方法 这样的方法适用于int范围内数的处理。 代码示例如下: //the method of String2int String str="1234"; int n = Integer.parseInt(str); String类的valueOf方法族 valueOf方法族将其他类型数据转换为String类,例如int、double、char[]等等。示例代码如下: int n = 8373; String str1 = String.valueOf(n); System.out.println(str1); double dn = 8434.3434; String str2 = String.valueOf(dn); System.out.println(str2);