代码之家  ›  专栏  ›  技术社区  ›  Whosayin20

Java/“高级”检查[关闭]

  •  0
  • Whosayin20  · 技术社区  · 7 年前

    我希望你能进一步帮助我,

    谢谢

    1 回复  |  直到 7 年前
        1
  •  1
  •   Tim Biegeleisen    7 年前

    你可以尝试在这里使用模数,例如。

    if (position_x % 20 == 0 && position_x >=0 && position_x <= 1280) {
        System.out.println("position_x is a multiple of 20 and within range.");
    }
    else {
        System.out.println("position_x is out of range or not a multiple of 20.");
    }