因此,我有很多输入,我总是希望在我应该使用哪个运算符的数字之间存在正向的差别。
让我们说
T1 T2 Output
3 5 2
7 6 1
5 9 4发布于 2022-05-29 20:34:41
您需要一个Math.abs()方法。返回int/double/float/long值的绝对值(取决于传入参数的类型)。
例如:
int output = Math.abs(T1 - T2);
System.out.println(output);/或
System.out.println(Math.abs(T1 - T2));https://stackoverflow.com/questions/72426382
复制相似问题