我想要特定条件的动态输出,我的条件是:
size = 3;
countersize = 8; //can be anything based on the user input.
如果我将计数器尺寸设为 4 或 5 或 8,那么对于特定计数器尺寸,我的输出应该是这些 0 或 1 或 2 中的任何一个。输出应该 < 3。
示例 1:
**user Input:** countersize=7 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=5 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=3 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=0 then output=0
**user Input:** countersize=1 then output=1
**user Input:** countersize=2 then output=2
**user Input:** countersize=4 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=9 then output= 0 or 1 or 2 (only one from these)
示例 2: 假设 size = 2; 和 countersize = 8;// 可以是任何基于用户输入的东西。
**user Input:** countersize=7 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=5 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=3 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=0 then output=0
**user Input:** countersize=1 then output=1
**user Input:** countersize=2 then output=0 or 1 or 2 (only one from these)
**user Input:** countersize=4 then output= 0 or 1 or 2 (only one from these)
**user Input:** countersize=9 then output= 0 or 1 or 2 (only one from these)
请帮助我处理我的 Java 代码。