You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
772 B
42 lines
772 B
package com.platform.test;
|
|
|
|
import java.util.Date;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class StringIntegerTest {
|
|
|
|
@Test
|
|
public void testString2Int() {
|
|
String a = "0";
|
|
String a1 = "1";
|
|
int r = 0;
|
|
Date f = new Date();
|
|
int b = Integer.valueOf(a);
|
|
int b1 = Integer.valueOf(a1);
|
|
for (int i = 0; i < 1000000; i++) {
|
|
|
|
r = b & b1;
|
|
}
|
|
System.out.println(r);
|
|
System.out.println("1: "+(new Date().getTime() - f.getTime()));
|
|
|
|
String c = "1";
|
|
Date f3 = new Date();
|
|
String d = "";
|
|
for (int i = 0; i < 1000000; i++) {
|
|
if (a.equals(a1)){
|
|
if (a.equals(c)) {
|
|
d= "1";
|
|
}
|
|
}
|
|
else {
|
|
a = a1;
|
|
}
|
|
}
|
|
System.out.println(d);
|
|
System.out.println("2: "+(new Date().getTime() - f3.getTime()));
|
|
}
|
|
|
|
}
|