upload android base code part3

This commit is contained in:
August 2018-08-08 16:48:17 +08:00
parent 71b83c22f1
commit b9e30e05b1
15122 changed files with 2089659 additions and 0 deletions

View file

@ -0,0 +1,2 @@
Sleeping 1000 msec...
Done sleeping

View file

@ -0,0 +1,3 @@
Test that Thread.sleep() operates reasonably. This test is actually
mostly meant as an easy thing to modify in order to test other things
in an ad-hoc way.

View file

@ -0,0 +1,22 @@
public class Main {
static public void main(String[] args) throws Exception {
int millis = 1000;
if (args.length > 1) {
millis = Integer.parseInt(args[1]);
}
System.out.println("Sleeping " + millis + " msec...");
long start = System.currentTimeMillis();
Thread.sleep(millis);
long elapsed = System.currentTimeMillis() - start;
long offBy = Math.abs(elapsed - millis);
System.out.println("Done sleeping");
if (offBy > 250) {
System.out.println("Actually slept about " + elapsed + " msec...");
}
}
}