取得数据在一个范围内,不超过最大小值,不小于最小值。 public static float clamp(float number, float min, float max) { return Math.max(min, Math.min(max, number)); }
public static float clamp(float number, float min, float max) { return Math.max(min, Math.min(max, number)); }