public static long clamp(long value, long min, long max) {
    if (min > max) {
      throw new IllegalArgumentException(min + ">" + max);
    }
    return Math.min(max, Math.max(value, min));
  }
public static long clamp(long value, long min, long max)