package corejava;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* (机能概要描述)
*
* <pre>
* [变更履历]
* 09.07.20.NICKLE NET 初版
* </pre>
*
* @author NICKLE)王
*/
public class TempTest {
public String intpuString() throws Exception{
System.out.println("pealse input String");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String temp = br.readLine();
return temp;
}
public double stringToint(String str){
char[] c = str.toCharArray();
final int count = c.length;
double j = 0;
for(int i =0 ;i<count ;i++){
j = j+ Character.digit(c[i],10) * Math.pow(10,Double.valueOf(count-i-1) );
}
return j;
}
public static void main(String[] args)throws Exception{
TempTest t = new TempTest();
String temp = t.intpuString();
System.out.println((int)t.stringToint(temp));
}
}
String 转化 为Iint 不用Integer.valueOf()方法
最新推荐文章于 2022-12-08 17:22:22 发布