/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println((-10) >>> 1); System.
out.
println((-10) >> 1); System.
out.
println((-11) >> 1); System.
out.
println((-11) / 2); for (int x = -10; x < 10; ++x)
{
if (((x
- (x
>> 31)) >> 1) != x
/ 2) System.
out.
println("Not equal for: " + x
); }
int bounds = 80000000;
long start
= System.
nanoTime(); for (int i = -bounds; i < bounds; ++i)
{
int r = ((i - (i >> 31)) >> 1);
}
long run1
= System.
nanoTime() - start
; for (int i = -bounds; i < bounds; ++i)
{
int r = i / 2;
}
long run2
= System.
nanoTime() - start
;
System.
out.
printf("Run 1: %10d\n", run1
); System.
out.
printf("Run 2: %10d\n", run2
); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigoLTEwKSA+Pj4gMSk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCgtMTApID4+IDEpOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigoLTExKSA+PiAxKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oKC0xMSkgLyAyKTsKICAgICAgICBmb3IgKGludCB4ID0gLTEwOyB4IDwgMTA7ICsreCkKICAgICAgICB7CiAgICAgICAgICAgIGlmICgoKHggLSAoeCA+PiAzMSkpID4+IDEpICE9IHggLyAyKSBTeXN0ZW0ub3V0LnByaW50bG4oIk5vdCBlcXVhbCBmb3I6ICIgKyB4KTsKICAgICAgICB9CiAgICAgICAgCiAgICAgICAgaW50IGJvdW5kcyA9IDgwMDAwMDAwOwogICAgICAgIGxvbmcgc3RhcnQgPSBTeXN0ZW0ubmFub1RpbWUoKTsKICAgICAgICBmb3IgKGludCBpID0gLWJvdW5kczsgaSA8IGJvdW5kczsgKytpKQogICAgICAgIHsKICAgICAgICAgICAgaW50IHIgPSAoKGkgLSAoaSA+PiAzMSkpID4+IDEpOwogICAgICAgIH0KICAgICAgICBsb25nIHJ1bjEgPSBTeXN0ZW0ubmFub1RpbWUoKSAtIHN0YXJ0OwogICAgICAgIHN0YXJ0ID0gU3lzdGVtLm5hbm9UaW1lKCk7CiAgICAgICAgZm9yIChpbnQgaSA9IC1ib3VuZHM7IGkgPCBib3VuZHM7ICsraSkKICAgICAgICB7CiAgICAgICAgICAgIGludCByID0gaSAvIDI7CiAgICAgICAgfQogICAgICAgIGxvbmcgcnVuMiA9IFN5c3RlbS5uYW5vVGltZSgpIC0gc3RhcnQ7CiAgICAgICAgCiAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIlJ1biAxOiAlMTBkXG4iLCBydW4xKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50ZigiUnVuIDI6ICUxMGRcbiIsIHJ1bjIpOwoJfQp9