```
public boolean canMeasureWater(int x, int y, int z) {
if(z>y && z>x)return false;
if(z%gcd(x,y)==0)return true;
return false;
}
public int gcd(int x,int y){
if(y==0)return x;
return gcd(y,x%y);
}
```