Assertions

Category: Assertions
Author: Stuart Reges
Book Chapter: 5.5
Problem: Assertions
	You will identify various assertions as being either always true, never true or sometimes true/sometimes false at various points in program execution.  The comments in the method below indicate the points of interest. 

public static int mystery(int x) {
	int y = 1;
	int z = 0;
	<span class="assertionpoint">// Point A
	while (x > y) {
		<span class="assertionpoint">// Point B
		z += x - y;
		x /= 2;
		<span class="assertionpoint">// Point C
		y *= 2;
		<span class="assertionpoint">// Point D
	}
	<span class="assertionpoint">// Point E
	return z;
}

1) x > y
2) z > 0
3) y % 2 == 0