Java Reference
In-Depth Information
r
new
=
r
old
2
b
new
=
b
old
i
old
/
i
new
=
2
Therefore,
2 i
old
/
2
i
new
(
b
old
)
r
new
b
new
=
r
old
i
old
=
r
old
b
old
= a
n
On the other hand, if
i
old
is odd, then
r
new
=
r
old
b
old
b
new
=
b
old
i
new
=
i
old
ɨ 1
Therefore,
i
new
i
old
ɨ 1
r
new
b
new
=
r
old
b
old
b
old
i
old
=
r
old
b
old
= a
n
262
263
In either case, the new values for
r
,
b
, and
i
fulfill the loop invariant (I). So what?
When the loop finally exits, (I) holds again:
b
i
a
n
r
=