Check if a variable is between two numbers with Java

后端 未结 7 1976
暗喜
暗喜 2020-12-10 13:35

I have a problem with this code:

if (90 >>= angle =<< 180)

The error explanation is:

The left-hand side

7条回答
  •  伪装坚强ぢ
    2020-12-10 13:47

    public static boolean between(int i, int minValueInclusive, int maxValueInclusive) {
        if (i >= minValueInclusive && i <= maxValueInclusive)
            return true;
        else
            return false;
    }
    

    https://alvinalexander.com/java/java-method-integer-is-between-a-range

提交回复
热议问题