サンプル

public class ClassA {
public int test (int i)
{
if (i == 0) {
return 1;
}
else{
return 0;
}
}
}

解決策
コード構造を見直し、1 つの return ステートメントのみを残してください。