public class NumberFormatTest {
public static void main(String[] args) throws Exception {
String time = "20";
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
//1
// return type int
NumberFormat.getIntegerInstance().parse(time).intValue();
}
System.out.println(System.currentTimeMillis() - start);
long start2 = System.currentTimeMillis();
for (int j = 0; j < 100000; j++) {
//2
// return type int
Integer.parseInt(time);
}
System.out.println(System.currentTimeMillis() - start2);
long start3 = System.currentTimeMillis();
for (int k = 0; k < 100000; k++) {
//3
// return type Integer
Integer.valueOf(time);
}
System.out.println(System.currentTimeMillis() - start3);
}
}
public class NumberFormatTest { public static void main(String[] args) throws Exception { String time = "20"; long start = System.currentTimeMillis(); for (int i = 0; i < 100000; i++) { //